开发者

How to load images in UIScrollView asynchronously?

开发者 https://www.devze.com 2023-03-02 09:46 出处:网络
HI, I am getting my images usi开发者_如何学运维ng JSON and I need to display image at a time when my app is running so please tell me how to use asynchronous method to load the images into the UIScro

HI,

I am getting my images usi开发者_如何学运维ng JSON and I need to display image at a time when my app is running so please tell me how to use asynchronous method to load the images into the UIScrollView?

Thanks.


whether you use a UITableView or a UIScrollView, you will use the same pattern, its just that you have a bit more plumbing to do with the UIScrollView. I would say use the UITableView unless you want to roll your own multi-column image thumbnail picker.

With the UIScrollView, you will need to create your own virtual rows and columns and detect when the ScrollView has scrolled a new row or a new column into view. You will need to queue (remove) the images that have scrolled out of view, and then load the images that have come into view. All in all, this is not trivial code.

The UITableView does all this for you (rows only, no concept of columns)

Having said that.. here is a reference to using the NSOperation class to lazy load your images into a UITableView while giving the user a smooth experience..

UIImage in uitableViewcell slowdowns scrolling table

0

精彩评论

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