开发者

UScrollView lazy loading unload view

开发者 https://www.devze.com 2023-04-06 21:36 出处:网络
I have a question regarding the page control sample code from apple. in the sc开发者_C百科rollViewDidScroll method there\'s a comment:

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

精彩评论

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

关注公众号