tags:

views:

24

answers:

2

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?");

}

+1  A: 

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.

Jasarien
A: 

Thanks, that worked.

jp chance