We are seeing unusual behavior with respect to the Keyboard willshow and will hide the iOS 8.3 notification.
The view controller (listening to keyboard notifications) has text information and when you press and when you press the submit button, the method first resets the first responder from the text field and displays a warning for the warning. Everything works fine, it rejects the keyboard and displays a warning as expected. (also calls the UIKeyboardWillHideNotification method).
However, in 8.3, after clicking OK / Cancel on the Alertview, it rejects the warning, and it calls UIKeyboardWillShowNotification and UIKeyboardWillHideNotification respectively, although it should not have been called! This was not expected, as the keyboard had already been fired before sending a warning!
Here is a piece of code that we are trying:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; } - (IBAction)ShowAlert:(id)sender { [self.TxtField resignFirstResponder]; //This woudln't make any diff either :( [self.view endEditing:YES]; [self ShowAlertForTest]; } -(void)ShowAlertForTest{ UIAlertView *theAlertView= [[UIAlertView alloc]initWithTitle:@"Title" message:@"msg" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Yes", nil]; [theAlertView show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog(@"buttonIndex = %ld",buttonIndex); } - (void)keyboardWillShow:(NSNotification *)aNotification { NSLog(@"keyboardWillShow"); } - (void)keyboardWillHide:(NSNotification *)aNotification { NSLog(@"keyboardWillHide"); }
This behavior causes problems in our application when cascading warnings appear, triggered from the previous alertview'd delegate - bringing the keyboard to unnecessary situations.
Any help / advice is appreciated!
source share