I need to know if it’s better to use NSOperation or Block to load a large number of image into a UIScrollView? I create all the Imageview and positioning each UIImageView in the right position into the scroll.
To avoid memory warning I choose to load the image once at time. My idea is to create a sort of queue and insert all the image to load in the queue. I have to use block or NSOperation to do this?
In
tableView:cellForRowAtIndexPath:, you can use GCD (Grand Central Dispatch) to load the images asynchronously.Like this:
Edit: For a better answer, watch WWDC ’12 Session 211 – “Building Concurrent User Interfaces on iOS” (thanks @sc0rp10n!)