views:

35

answers:

1

I need to add some methods to the delegate protocol of my custom UITextField subclass. So I put this in the header:

@protocol MyTextFieldDelegate (UITextFieldDelegate)
- (void)textfieldDidSomething:(UITextField*)textField;
@end

Is this fine?

+2  A: 

In principle I think it looks fine. The only point I would make is I would write something like:

@protocol MyTextFieldDelegate (MyTextFieldDelegateExtras)
- (void)textfieldDidSomething:(UITextField*)textField;
@end

to distinguish it from the methods defined in the UITextFieldDelegate protocol.

But really if you want to extend the protocol, then use:

@protocol MyTextFieldDelegate <UITextFieldDelegate>
- (void)textfieldDidSomething:(UITextField*)textField;
@end
petert