I have an observer for UIKeyboardWillShowNotification and UIKeyboardWillHideNotification .
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
Everything works, except that it works when the viewController is not currently displayed.
I tried comparing with self.navigationcontroller.topViewController , but this does not work when I have a modal view presented as a topViewController that is under the modal view controller.
source share