Reputation: 33
I am trying to get a notification when the keyboard is about to be displayed, but currently it is firing AFTER showing the keyboard.
Here is my notification registration:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidShow:)
name: UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidHide:)
name: UIKeyboardDidHideNotification
object:nil];
Upvotes: 2
Views: 60
Reputation: 1253
Try using this:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidShow:)
name: UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector (keyboardDidHide:)
name: UIKeyboardWillHideNotification
object:nil];
Changing UIKeyboardDidShowNotification
to UIKeyboardWillShowNotification
Upvotes: 1