Reputation: 559
I need to do some processing after my user leaves a text field.
I thought I had turned on notification by doing this:
@interface CreditCardAppViewController : UIViewController
<UITextFieldDelegate> {
However, my events are not getting fired. I don't know why?
- (void)textFieldDidBeginEditing:(UITextField *)textField {
NSLog(@"This never gets called, Why?");
}
Upvotes: 0
Views: 84
Reputation: 58448
You need to set the text field's delegate. If you created the text field in code, then something like [myTextField setDelegate:self];
or if you created the text field in Interface Builder, control + click + drag from the text field to your view controller instance, and select delegate.
Without setting the delegate, the delegate messages will never be sent to your controller.
Upvotes: 3