I am curious about conforming a class to UITextFieldDelegate, in the past I have always added it to enable access to methods defined within the protocol. However this last time I forgot to add it, only realising later that it was missing. My question is why does it work with or without, I thought it was needed to correctly access the protocol methods?
@interface MyController : UIViewController <UITextFieldDelegate> {
UITextField *text_001;
}
@property(nonatomic, retain) IBOutlet UITextField *text_001;
@end
OR:
@interface MyController : UIViewController {
UITextField *text_001;
}
@property(nonatomic, retain) IBOutlet UITextField *text_001;
@end
WITH:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
NSLog(@"Return: ... ");
[textField resignFirstResponder];
return YES;
}
Cheers Gary