iPhone OS 4.0 上的键盘问题 (8A248c)

发布于 2024-08-30 21:29:13 字数 277 浏览 3 评论 0原文

我有带有文本字段的视图 - 来自 UIAlertView 的子类。在textFieldShouldReturn 委托中,我为文本字段调用resignFirstResponder,为视图调用dismissWithClickedButtonIndex。在 3.x 版本上一切正常,但在 4.0 版本上,视图关闭后键盘仍然出现在屏幕上,并且在应用程序运行时不会消失。应用程序针对 3.0 目标进行编译,并在 4.0 iPhone 操作系统上进行测试。还有一件事 - 有时在解除警报后 - 键盘上的“完成”按钮会替换为“返回”按钮。.有什么建议吗?

I have view with text field -- subclassed from UIAlertView. In the textFieldShouldReturn delegate I call resignFirstResponder for text field and dismissWithClickedButtonIndex for view. On the 3.x version everything fine, but on 4.0 keyboard still present on screen after view dismissing and doesn't disappear while app running. App compiled for 3.0 target and tested on 4.0 iPhone OS. One more thing - sometimes after dismissing alert - Done button on the keyboard replaces with Return button.. Any suggestions ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦魇绽荼蘼 2024-09-06 21:29:13

奇怪的事情..我编写了函数来通过计时器查找键盘视图并为其设置动画,但是当键盘出现在屏幕上时却无法找到它。
像这样的事情:

for( UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows] ){
    for( UIView *keyboard in [keyboardWindow subviews] ){
        NSString *desc = [keyboard description];
        if( [desc hasPrefix:@"<UIKeyboard"]==YES ) {
            // animate out
        }
    }
}

Strange thing.. I wrote functions to find and animate out keyboard view by timer but keyboard can't be found while it present on the screen..
Something like this:

for( UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows] ){
    for( UIView *keyboard in [keyboardWindow subviews] ){
        NSString *desc = [keyboard description];
        if( [desc hasPrefix:@"<UIKeyboard"]==YES ) {
            // animate out
        }
    }
}
生活了然无味 2024-09-06 21:29:13

canResignFirstResponder 返回什么?我在升级到 4.0 时遇到了与您描述的相同的问题,通过更加关注此功能来解决它​​。如果您返回“否”,请尝试“是” - 如果您发现这具有所需的效果,请稍后整理条件。

What is canResignFirstResponder returning? I had the same problem you describe going to 4.0, fixed it by paying more attention to this function. If you're returning NO, try YES - sort out the conditions later if you find this has the desired effect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文