开发者

UScrollView lazy loading unload view

I have a question regarding the page control sample code from apple.

in the sc开发者_C百科rollViewDidScroll method there's a comment:

// A possible optimization would be to unload the views+controllers which are no longer visible

I wonder how to unload the views+controllers. As I have problems with my memory management I really need that.

Hope anyone can help.


From your scrollViewDidScroll you could figure out the current coordinates the user is in from the contentSize with this as the user scrolls out a certain viewController pop that viewController or view from of the current view.

[currentView removeFromSubView];

You could do this but I would suggest you try to use UITableView as this is all damn easy to do it there...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜