Guest User

Untitled

a guest
Jul 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. - (void)keyboardWillShow:(NSNotification *)note {
  2. [UIView beginAnimations:nil context:NULL];
  3. [UIView setAnimationDuration:0.3];
  4. [UIView commitAnimations];
  5. CGRect r = self.loginToolbar.frame, t;
  6. [[note.userInfo valueForKey:UIKeyboardBoundsUserInfoKey] getValue: &t];
  7. r.origin.y -= t.size.height;
  8. self.loginToolbar.frame = r;
  9.  
  10.  
  11. }
  12.  
  13. - (void)keyboardWillHide:(NSNotification *)note {
  14. CGRect r = self.loginToolbar.frame, t;
  15. [[note.userInfo valueForKey:UIKeyboardBoundsUserInfoKey] getValue: &t];
  16. r.origin.y -= t.size.height;
  17. self.loginToolbar.frame = r;
  18. [UIView beginAnimations:nil context:NULL];
  19. [UIView setAnimationDuration:0.3];
  20. [UIView commitAnimations];
  21. }
  22.  
  23. - (void)viewDidLoad {
  24. NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
  25. [nc addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  26. [nc addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
  27.  
  28. self.appDelegate = (ZoolooAppDelegate *)[[UIApplication sharedApplication] delegate];
  29. [super viewDidLoad];
  30. }
Add Comment
Please, Sign In to add comment