Reputation:
I am calling an action from textFieldDidBeginEditing as follows:
[dotButton addTarget:self action:@selector(actionButton:) forControlEvents:UIControlEventTouchUpInside];
and specifiying my action as:
- (void) actionButton:(id)sender {
textField.text = [textField.text stringByAppendingString:@"APPROVED"];
}
Simple question with hopefully a simple answer....
textField.text refers to the field named textField but how do I update the current field that textFieldDidBeginEditing is acting on at the time?? i.e can I set a variable to retrieve the current fieldname?
Thanks
Upvotes: 0
Views: 2965
Reputation: 6949
You should check whether or not the textField the label of your interest. An example:
if (textField == self.firstLabel){
//do something
}
else if (textField == self.secondLabel){
//do other something
}
The textField variable that is passed from the delegate method is the one that you should handle.
Tell me if it works. Good luck!
Upvotes: 1