Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)keyboardWillHide:(NSNotification *)n
- {
- NSDictionary *userInfo = [n userInfo];
- CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
- CGRect viewRect = [[self view] frame];
- viewRect.origin.y += keyboardSize.height;
- [[self view] setFrame:viewRect];
- [UIView commitAnimations];
- keyboardIsShown = NO;
- }
- - (void)keyboardWillShow:(NSNotification *)n
- {
- if (keyboardIsShown) {
- return;
- }
- NSDictionary *userInfo = [n userInfo];
- CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
- CGRect viewRect = [[self view] frame];
- viewRect.origin.y -= keyboardSize.height;
- [[self view] setFrame:viewRect];
- [UIView commitAnimations];
- keyboardIsShown = YES;
- }
Add Comment
Please, Sign In to add comment