What's the best way to determine which UITextField
triggers the method -(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
(or any of the other UITextFieldDelegate methods)? I've seen code like this before:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (textField == textFieldCode) {
return YES;
}
return NO;
}
but this only works if I have textFieldCode
as an ivar in my class, and in this case I'm just initializing a couple of UITextField
s and putting them in a table, so I don't have references to them in the class.
I was thinking that I could use the hash function and store the hashes for each textField somewhere in the class, and then compare textField
's hash to the desired hash in the method call, but that seems like kind of a hack.