Reputation: 13860
I want to do UIScrollView
with a lot of small UIImageView
, and i want to display immediately blank scroll view. And then when it's ready load images into UIImageViews
.
For example when i have to download some part from the server i'm using:
connectionDidFinishLoading
with NSURLConnection
but here i don't want to download online images, i have it in my app, but don't want to draw all in once in viewDidLoad
. How to achieve this?
Upvotes: 0
Views: 488
Reputation: 38239
Refer bddynamicgridviewcontroller link for UIImageView list in a row-dominated grid layout
Also refer SDWebImage for lazy loading of lots of images
take look at UITables with Downloaded Images – Easy Asynchronous Code link
Upvotes: 1
Reputation: 3698
To start with, use AQGridView
- it's similar to UITableView
but allows multiple columns per row (i.e. a grid of photos). If you download the source code it has examples of how to use it for what you want.
As for showing the images as they download, one way is to use FLImageView
. Again, download the source code and add it to your project and then instead of using a UIImageView
in each AQGridViewCell
use a FLImageView
then call loadImageAtURL:placeholderImage:
or loadImageAtURLString:placeholderImage:
when you load the image. This also allows you to display a standard placeholder image while images are downloading.
Like a standard UITableView
, cells for AQGridView
will only be created as needed (i.e. only the ones on screen or almost on screen) and cells are reused so it will be nice and fast.
Upvotes: 0