Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. - (void)viewDidAppear:(BOOL) animated {
  2. [super viewDidAppear:animated];
  3. // Register notification when the keyboard will be show
  4. [[NSNotificationCenter defaultCenter] addObserver:self
  5. selector:@selector(keyboardWillShow:)
  6. name:UIKeyboardWillShowNotification
  7. object:nil];
  8.  
  9. // Register notification when the keyboard will be hide
  10. [[NSNotificationCenter defaultCenter] addObserver:self
  11. selector:@selector(keyboardWillHide:)
  12. name:UIKeyboardWillHideNotification
  13. object:nil];
  14. }
  15.  
  16. - (void)keyboardWillShow:(NSNotification *)notification {
  17. CGRect keyboardBounds;
  18.  
  19. [[notification.userInfo valueForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&keyboardBounds];
  20.  
  21. // Do something with keyboard height
  22. }
  23.  
  24. - (void)keyboardWillHide:(NSNotification *)notification {
  25. CGRect keyboardBounds;
  26.  
  27. [[notification.userInfo valueForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&keyboardBounds];
  28.  
  29. // Do something with keyboard height
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement