开发者

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

开发者 https://www.devze.com 2023-01-07 23:39 出处:网络
Is this possible?For example, I have a class TriangleDataView with an init method.Currently the method is declared like this:

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 UIT开发者_如何转开发extFieldDelegate protocol. But what is the syntax for that?


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

精彩评论

暂无评论...
验证码 换一张
取 消