You should move [self registerForKeyboardNotifications];
to viewDidAppear
and unregister in viewDidDisappear
.
By registering in viewDidLoad
and unregistering in dealloc
, especially within a navigation controller, the notification will fire once for every view controller on the navigation stack. You only need to call it for the currently visible view.
Alternatively, you could subclass the navigation controller and have it call a method on its currently visible controller. Then you don't have to do all this registering and unregistering. Just register once in a nav controller subclass and have that class pass the message along to the proper view controller.