Created
May 22, 2018 01:20
-
-
Save alexpaul/d2d9b949bc875e20076d8fed435876a8 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
#pragma mark Keyboard Handling | |
- (void)registerForKeyboardNotifications { | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |
} | |
- (void)keyboardWillShow: (NSNotification *)notification { | |
NSDictionary *userInfo = [notification userInfo]; | |
CGSize size = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; | |
self.tipView.transform = CGAffineTransformMakeTranslation(0, -size.height); | |
} | |
- (void)keyboardWillHide: (NSNotification *)notification { | |
self.tipView.transform = CGAffineTransformIdentity; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment