UITextView Keyboard with keyboard AccessoryView turns blue (inverts) after springboard

On an iOS8 device or iOS8 simulator:

I have a UITextView that becomes the first responder. Everything is fine until the application resigns (with a home key press).

After the application becomes active again, the appearance of the keyboard is mutated - see image

enter image description here

There is an AccessoryView keyboard on the keyboard, which I removed from the image for client privacy. However, if you remove the AccessoryView keyboard, bad behavior does not occur.

The only solution I have today is to resignFirstResponder on UIApplicationWillResignActiveNotification and become FirstResponder on UIApplicationDidBecomeActiveNotification .

Has anyone else seen this problem and [hopefully] fixed it?

For completeness, here is a screenshot of the keyboard before the application goes to Springboard

enter image description here

+5
source share
1 answer

The best mitigation so far is as follows:

Adding notification handlers to capture when the application becomes active / reactive

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(activateKeyboard) name:UIApplicationDidBecomeActiveNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deactivateKeyboard) name:UIApplicationWillResignActiveNotification object:nil]; 

Then, after discovering this SO answer, which is a bit old, I tried to make startFirstResponder as quickly as possible.

 - (void)activateKeyboard; { [UIView animateWithDuration:0.0f animations:^{ [self.textView becomeFirstResponder]; }]; } - (void)deactivateKeyboard; { [self.textView resignFirstResponder]; } 
+1
source

Source: https://habr.com/ru/post/1203200/


All Articles