- [UITextField isFirstResponder]返回false,即使字段当前正在编辑 [英] -[UITextField isFirstResponder] returns false even though field is currently editing

查看:349
本文介绍了 - [UITextField isFirstResponder]返回false,即使字段当前正在编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的视图控制器的 -viewDidLoad 方法,我调用 [myTextField becomeFirstResponder]; 打开键盘和myTextField获取焦点。

In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a charm, opens the keyboard and myTextField gets focus.

我有一个带有目标操作的按钮(操作在同一个控制器中),检查 [myTextField isFirstReponder] - 但它总是返回false(∈, NO 在Cocoa术语;))。

I have a button with a target action (the action is in the same controller) that checks [myTextField isFirstReponder] - but it always returns false (er, NO in Cocoa terms ;)).

这不是正确的方法来找出 myTextField 是否有键盘输入?

Is that not the right way to find out if myTextField has the keyboard up for input?

推荐答案

如何检查编辑属性的值,例如[myTextField isEditing]?

What about checking the value of the editing property, ie [myTextField isEditing]?

我认为你的按钮接管第一响应者状态当您点击它。

I think your button takes over first responder status when you tap it.

这篇关于 - [UITextField isFirstResponder]返回false,即使字段当前正在编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆