开发者

Wrapping a UITableViewController in NSProxy

I have a subclass of NSProxy designed to forward messages to either an object instance or to Lua functions if they are defined for the selector. This works in most cases. UITableViewController, however, is a different case altogether. When I set up my proxy object with an instance of UITableViewController (or a stub subclass) it doesn't seem to ever receive any of the UITableViewDelegate or U开发者_运维技巧ITableViewDatasource messages that I expect it to.

I have the necessary methods implemented up in Lua, and they respond correctly when called manually, but they never seem to be called when I add the proxy UIViewController view to the hierarchy. What might I be missing?


You're probably getting tripped up by the way that some UIKit classes handle their delegate connection. They keep a set of flags internally indicating what messages the delegate can respond to. When you set the delegate or datasource outlet, the TableView will send several -respondsToSelector: messages to the object in question, and remember which ones returned TRUE.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜