Created
April 5, 2013 12:29
-
-
Save maojj/5318939 to your computer and use it in GitHub Desktop.
keyboard animation
This file contains 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)keyboardWillShow:(NSNotification *)notification { | |
NSDictionary *info = [notification userInfo]; | |
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey]; | |
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; | |
CGSize keyboardSize = [aValue CGRectValue].size; | |
CGRect viewFrame = CGRectMake(0, | |
0, | |
UI_SCREEN_WIDTH, | |
self.View.frame.size.height - keyboardSize.height); | |
[UIView animateWithDuration:duration animations:^{ | |
self.view.frame = viewFrame; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment