William Jockusch
William Jockusch

Reputation: 27335

require that an object passed into an objective C method conform to a protocol?

Is this possible? For example, I have a class TriangleDataView with an init method. Currently the method is declared like this:

- (id)initWithFrame:(CGRect)frame delegate: (id) delegateObject;

I would like to require that delegateObject conform to the UITextFieldDelegate protocol. But what is the syntax for that?

Upvotes: 2

Views: 215

Answers (1)

Marcelo Cantos
Marcelo Cantos

Reputation: 186058

- (id)initWithFrame:(CGRect)frame delegate:(id<UITextFieldDelegate>)delegateObject;

Upvotes: 6

Related Questions