开发者

How to find out whether a given class serves as a delegate for an object?

In Objective-C, how can one find out whether a given class serves as 开发者_JS百科a delegate for a given type of an object?

A book i am reading suggest examining the .h file, however i am not sure exactly what to look for. How would .h file declare that it's .m is a delegate for some object?

Please clarify.


If the delegating class has a protocol for its delegate, you could check whether the class conforms to that protocol. Otherwise, look for the methods that the delegate is supposed to implement (e.g. the tableView:…: family of methods for an NSTableView delegate).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜