//Get Notification whether Keyboard is showing or not [self registerForKeyboardNotifications];
#pragma mark - Notify Keyboard is Showing / Hiding - (void)registerForKeyboardNotifications { // Call this method somewhere in your view controller setup code. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotification object:nil]; }
#pragma mark - Handle Keyboard Notification - (void)keyboardWasShown:(NSNotification*)aNotification { // Called when the UIKeyboardDidShowNotification is sent. //Create Animation Block for UIView //NSDictionary* info = [aNotification userInfo]; //CGRect beginFrame = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; //CGRect endFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; //DebugLog(@"beginFrame %f",beginFrame.size.height); //DebugLog(@"endFrame %f",endFrame.size.height); } - (void)keyboardWillBeHidden:(NSNotification*)aNotification { // Called when the UIKeyboardWillHideNotification is sent }
– How to make an iOS App
ktrkathir