zhuber
zhuber

Reputation: 5524

Lazy loading iPhone images

If I would like to have lazy loading like google+ or facebook app (maybe even 9gag), should I go with UITableView or UIScrollView?

The goal is to load whole new set of cells or scrollview pages (not just thumbnail like apple lazyloading tableview). If you have facebook app, try scrolling down fast and you will see what I mean.

Any example would be also helpful.

Thanks.

Upvotes: 1

Views: 3066

Answers (5)

AMohan
AMohan

Reputation: 534

Using Grand Central Dispatch you can do this.

The following link might be useful.

http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial

Upvotes: 1

Vishal
Vishal

Reputation: 8256

You can try this: https://github.com/nicklockwood/AsyncImageView. This is a best example for loading images asynchronously. The library can also be used to load and cache images independently of a UIImageView as it provides direct access to the underlying loading and caching classes.

Upvotes: 1

Ben Coffman
Ben Coffman

Reputation: 1740

I would use a uicollection view. Here is an example that uses uitableview, but you can take it and modify it a bit to work with a collection view.

http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html

If you would like to use a third party library, I would suggest looking at AFNetworking It's one of the most highly used and has a very easy to use function that extends UIImageView LINK

Also as an FYI, a scrollview is part of a tableview.

Upvotes: 0

Mat
Mat

Reputation: 7633

Take a look at SDWebImage, really easy to use, it support caching and asynchronous loading.

Upvotes: 0

FlaSh
FlaSh

Reputation: 55

You should prefer table view for this. with tableview , You can use reusable customcell. tableview can be useful for Auto layout in landscape mode and if app is universal the tableview is more useful.

Upvotes: 1

Related Questions