Skip to content

Instantly share code, notes, and snippets.

@soberman
Last active August 29, 2015 14:27
Show Gist options
  • Save soberman/def4ad03fb531b21d916 to your computer and use it in GitHub Desktop.
Save soberman/def4ad03fb531b21d916 to your computer and use it in GitHub Desktop.
How to get iOS keyboard height programmatically
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
}
- (void)keyboardWillShow:(NSNotification *)notification {
NSLog(@"%f", [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue].size.height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment