Programmatically check if iPhone keyboard is on screen or not
15,593
Basically, you want to add an NSNotificationCenter
observer:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow) name:UIKeyboardDidShowNotification object:nil];
Author by
Mason
Updated on June 27, 2022Comments
-
Mason almost 2 years
Possible Duplicate:
How to programatically check whether a keyboard is present in iphone app?
Detect if UIKeyBoard is ShowingIs there a way to programmatically check if the iPhone's keyboard is on screen or not?
-
Mason over 12 yearsI don't want it to necessarily call a function upon receiving the notification, though, I just want it to check before it adds a subview. It'll affect the frame of the subview.
-
Mason over 12 yearsOh wait, never mind. I can just change the value of a boolean. Thanks!
-
WrightsCS over 12 yearsYou can set the
selector
tonil
, but how else do you expect to know when it appears?