I have a custom field that allows the user to enter text in a UITextField. To the left of the UITextField is a UIButton. Something like this:
ENTER YOUR NAME: [name input field]
In the about the UIButton has the text "ENTER YOUR NAME:" and the UITextField is the [name input field].
When the user taps the UITextField, the keyboard is displayed on the device, as expected. However, if the user taps the text for "ENTER YOUR NAME:" nothing happens. This is also expected. I need to tell the UITextField that it should bring up the keyboard and begin editing if the UIButton is pressed.
(I have already thought about making the bounds of the UITextField encompass the UIButton. However, due to the alignment of the text in the UITextField, I can't do things like left or right justification. It must remain as centered text.) Thanks for any assistance you can provide.
What you can do is tie a method to the UIButton's touchDownInside action (in Interface Builder) that calls becomeFirstResponder
on the text field. The text field will then begin editing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With