开发者

Determine which control has focus [duplicate]

开发者 https://www.devze.com 2023-02-20 21:06 出处:网络
This question already has answers here: Get the current first responder without using a private API (28 answers)
This question already has answers here: Get the current first responder without using a private API (28 answers) Closed 9 years ago.

I am developing an 开发者_JAVA百科app for iPod/iPhone and I am trying to determine which control has focus. I am new to XCode so my terminology may be incorrect, but I am looking for the object (control) where the user is currently typing.

Hope someone can help!!

Thanks, Tony


you need to call

[myTextField isFirstReponder]

This will tell you if myTextField has focus

There is also

[myTextField isEditing]


If you are looking for just doing something on change of text in a control, you just need to wire up an IBAction to the control's change event and then everytime the text changes, your IBAction method will be called.

0

精彩评论

暂无评论...
验证码 换一张
取 消