Skip to content

Instantly share code, notes, and snippets.

@joaofranca
Created July 5, 2012 00:24
Show Gist options
  • Save joaofranca/3050270 to your computer and use it in GitHub Desktop.
Save joaofranca/3050270 to your computer and use it in GitHub Desktop.
- (void)subscribeToKeyboardEvents:(BOOL)subscribe{
if(subscribe){
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
}else{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment