- [UITextField isFirstResponder] returns false even if the field is currently editing

In my opinion, the controller is the -viewDidLoad method, I call [myTextField becomeFirstResponder]; It works like a charm, opens the keyboard, and myTextField gets focus.

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

Isn't that the right way to find out if myTextField keyboard for input?

+6
iphone cocoa-touch
source share
1 answer

How about checking the value of the editing property, i.e. [myTextField isEditing]?

I think your button takes the status of the first responder when you click it.

+12
source share

All Articles