gpt4 book ai didi

ios - 带有 keyboardAccessoryView 的 UITextView Keyboard 在 Springboard 之后变为蓝色(倒置)

转载 作者:可可西里 更新时间:2023-11-01 04:51:35 31 4
gpt4 key购买 nike

在 iOS8 设备或 iOS8 模拟器上:

我有一个成为第一响应者的 UITextView。一切正常,直到应用退出事件状态(通过按下主页键)。

应用程序再次激活后,键盘的外观发生了变化 - 参见图片

enter image description here

键盘确实有一个 keyboardAccessoryView,出于客户隐私考虑,我已将其从图像中移除。但是,如果删除 keyboardAccessoryView,则不会发生不良行为。

到目前为止,我唯一的解决方案是在 UIApplicationWillResignActiveNotification 上 resignFirstResponder 并在 UIApplicationDidBecomeActiveNotification 上成为 FirstResponder。

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

为了完整起见,这里是应用程序进入 Springboard 之前的键盘屏幕截图

enter image description here

最佳答案

目前最好的缓解措施如下 -

添加通知处理程序以在应用程序变为事件/ react 时捕获

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

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

然后找到this之后所以答案有点旧,我试图让 becomeFirstResponder 尽快发生。

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

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

关于ios - 带有 keyboardAccessoryView 的 UITextView Keyboard 在 Springboard 之后变为蓝色(倒置),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25992113/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com