Created
October 2, 2009 16:19
-
-
Save stevestreza/199870 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)keyboardWillHide:(NSNotification *)notification { | |
| NSLog(@"%s %@", __PRETTY_FUNCTION__, notification); | |
| double animationDuration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; | |
| UIViewAnimationCurve animationCurve = [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]; | |
| // there's a handy category for doing this in UIGeometry.h | |
| CGRect keyboardBounds = [(NSValue *)[[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; | |
| [UIView beginAnimations:@"hideKeyboardAnimation" context:nil]; | |
| // make sure you put these calls ABOVE your "self.view.frame = ..." call | |
| [UIView setAnimationCurve:animationCurve]; | |
| [UIView setAnimationDuration:animationDuration]; | |
| self.view.frame = CGRectMake(self.view.frame.origin.x, | |
| self.view.frame.origin.y, | |
| self.view.frame.size.width, | |
| self.view.frame.size.height + keyboardBounds.size.height); | |
| [UIView commitAnimations]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment