tags:

views:

310

answers:

1

I need to verify some user entry. I was thinking of adding it in this event? Also, how can I check to see if we are in a particular entry field ?

- (void)textFieldDidEndEditing:(UITextField *)textField
+1  A: 

You should create IBOutlet's to all of your view's text fields and compare them with the received 'textField' parameter.

For verifying a textField's contents, it would be better to use this delegate method:

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField

From this documentation:

Normally, you would return YES from this method to allow the text field to resign the first responder status. You might return NO, however, in cases where your delegate detects invalid contents in the text field. By returning NO, you could prevent the user from switching to another control until the text field contained a valid value.

gerry3