开发者

Wrapping a UITableViewController in NSProxy

开发者 https://www.devze.com 2022-12-11 06:29 出处:网络
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, howeve

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

精彩评论

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