iOS 4.2 的键盘问题

发布于 2024-10-06 00:04:52 字数 162 浏览 1 评论 0原文

我的应用程序在运行 iOS 4.1 的 iPhone 上正常运行,但在 iOS 4.2 上却不行。我将 UIInputField 设置为第一响应者,但键盘不显示。在viewDidLoad方法中调用becomeFirstResponder。这是一个错误还是苹果做出了重大改变?我正在使用 Xcode 3.2.5。

My app works as supposed on an iPhone running iOS 4.1 but not on iOS 4.2. I have an UIInputField set to first responder but the keyboard does not show up. The becomeFirstResponder is called in the viewDidLoad method. Is it a bug or has Apple made drastic changes? I'm using Xcode 3.2.5.

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

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

发布评论

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

评论(3

眼眸印温柔 2024-10-13 00:04:52

输入字段是否启用了用户交互? iOS 4.2 中现在要求这样做。

Does the input field have User Interaction Enabled? This is now required in iOS 4.2.

过气美图社 2024-10-13 00:04:52

-viewDidLoad 在视图首次初始化时调用,而不一定在显示时调用。尝试在 -viewDidAppear: 内调用 -becomeFirstResponder

 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];

     [myField becomeFirstResponder];
 }

-viewDidLoad is called when your view is first initialized, not necessarily when it's displayed. Try calling -becomeFirstResponder inside -viewDidAppear: instead:

 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];

     [myField becomeFirstResponder];
 }
几味少女 2024-10-13 00:04:52

在 Apple 开发者论坛 (https://devforums.apple.com/message/325348#325348) 上找到了一个线程,其中描述了解决方案。在调用 beginResponder 之前,最好在 viewDidLoad 方法中将 UITextField 属性 userInteractionEnabled 设置为 YES。

Found a thread at the Apple Developer Forums (https://devforums.apple.com/message/325348#325348) where a solution was described. Set the UITextField property userInteractionEnabled to YES before a call to becomeFirstResponder is made, preferably in the viewDidLoad method.

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