I have a screen with 6 UITextFields and 1 UIBarButtonItem called “Done”. As soon as the user type anything on any of the 6 UITextFields I would like to enable my UIBarButtonItem called “Done”, and also if the user delete the content I would like to return my UIBarByttonItem called “done” to disable mode. I would like to apply the same rule that Apple applied when you are adding a new contact in the iphone agenda. As soon as you type any information you are allowed to tap “done”. Is there any smart way to that?
Many thanks,
Marcos.
You need to setup a method to be called whenever a text field is changed. Apply this same method to all of the text fields. In the method, you check if the text field has text or not. Based on that check, you enable or disable the button.
Edit:
You will need an instance variable for all of the text fields so you can access all of them to see if the button should be disabled or not.