2014-09-23 20 views
5

在一个iOS8上设备或iOS8上模拟器后变成蓝色(反转):UITextView的键盘与keyboardAccessoryView跳板

我有成为第一响应一个UITextView。一切都很好,直到应用程序退出活动(通过家庭按键)。

在应用程序变得活跃再次键盘的外观突变 - 看到图像

enter image description here

键盘确实有,我已经从客户隐私图像中删除的keyboardAccessoryView。但是,如果删除keyboardAccessoryView不会发生不良行为。

我迄今唯一的解决办法是在UIApplicationWillResignActiveNotification和becomeFirstResponder resignFirstResponder上UIApplicationDidBecomeActiveNotification

有没有其他人看过这个问题,并[希望]修复它?

为了完整这里是键盘的截图应用去跳板前

enter image description here

回答

1

最好缓解至今如下 -

添加通知处理程序捕获时应用变为主动/被动

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

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

然后af找到this SO回答这是有点老,我试图使成为第一响应尽快发生。

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

- (void)deactivateKeyboard; 
{ 
    [self.textView resignFirstResponder]; 
}