Last active
August 29, 2015 14:02
-
-
Save jyliang/f6073a4c8ed2b69fbb0a 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)registerKeyboardNotifications { | |
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter]; | |
[dnc addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | |
[dnc addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |
[dnc addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; | |
[dnc addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; | |
} | |
- (void)unregisterKeyboardNotifications { | |
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter]; | |
[dnc removeObserver:self name:UIKeyboardWillShowNotification object:nil]; | |
[dnc removeObserver:self name:UIKeyboardWillHideNotification object:nil]; | |
[dnc removeObserver:self name:UIKeyboardDidShowNotification object:nil]; | |
[dnc removeObserver:self name:UIKeyboardDidHideNotification object:nil]; | |
} | |
- (void)keyboardWillShow:(id)notification { | |
NSDictionary* keyboardInfo = [notification userInfo]; | |
CGFloat keyboardHeight = [[keyboardInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size.height; | |
} | |
- (void)keyboardWillHide:(id)notification { | |
} | |
- (void)keyboardDidShow:(id)notification { | |
} | |
- (void)keyboardDidHide:(id)notification { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment