Dam*_*amo 5 keyboard uitextview ios xcode6 ios8
在iOS8设备或iOS8模拟器上:
我有一个UITextView成为第一响应者.一切都很好,直到应用程序重新启动(通过主页按键).
当应用程序再次变为活动状态时,键盘的外观会发生变异 - 请参阅图像

键盘确实有一个keyboardAccessoryView,我已从图像中删除它以保护客户端隐私.但是,如果删除keyboardAccessoryView,则不会发生不良行为.
我迄今为止唯一的解决方案是在UIApplicationWillResignActiveNotification上的 resignFirstResponder和UIApplicationDidBecomeActiveNotification上的firstFirstResponder .
有没有其他人看过这个问题并[希望]修复它?
为了完整性,这里是应用程序进入Springboard之前键盘的屏幕截图

迄今为止最好的缓解措施如下 -
添加通知处理程序以在应用程序变为活动/反应状态时进行捕获
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(activateKeyboard)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(deactivateKeyboard)
name:UIApplicationWillResignActiveNotification
object:nil];
Run Code Online (Sandbox Code Playgroud)
然后,在找到这个有点旧的答案后,我尝试让“becomeFirstResponder”尽快发生。
- (void)activateKeyboard;
{
[UIView animateWithDuration:0.0f
animations:^{
[self.textView becomeFirstResponder];
}];
}
- (void)deactivateKeyboard;
{
[self.textView resignFirstResponder];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
165 次 |
| 最近记录: |