I am trying to implement the :
- (BOOL) textFieldShouldReturn:(UITextField *)textField
method. For some reason it is not being called. I have set the text field to first responder in the code. I understand I also need to set the delegate for the text field in interface builder to 'files owner'. How do that? Thank you!
If you have declared your UITextField
as an IBOutlet
property, you can just add the following line in your viewDidLoad
: self.myTextField.delegate = self
Alternatively, you can do it in Storyboards.
You can right click drag from the text field on the interface builder canvas to the File's Owner
icon in the object list on the left.
Or you can select the text field, open the outlet inspector, drag from the little circle next to delegate
over to the File's Owner
icon in the object list.
Or you can right click drag from the text field icon in the object list to the same File's Owner
icon in that list.
Or you can set the delegate in code.
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