I have a UITextView and I implemented a keyboardWasShownMethod like so:
(void)keyboardWasShown:(NSNotification*)aNotification {
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect bkgndRect = inkTextField.superview.frame;
bkgndRect.size.height += kbSize.height;
[inkTextField.superview setFrame:bkgndRect];
[inkScroller setContentOffset:CGPointMake(0.0, inkTextField.frame.origin.y-kbSize.height) animated:YES];
inkTextField.frame=CGRectMake(1, -5, 285, 221);
NSLog(@"Called keyBoardWasShwon");
}
But for some reason it’s not getting called when my keyboard appears. This method is in the same class as the UITextView and the UITextView is declared in the .h file and connected in XIB. What could be the cause of this?
Did you add the observer for UIKeyboardWillShowNotification?