August 2011
Intermediate to advanced
552 pages
23h 48m
English
The next exercise is ImageSnarfer, which loads a batch of images from a website, controlled by a text file containing URLs, and displays them in a view. The NSOperation subclass will be a complex-lifetime operation.
Figure 21.4 ImageSnarfer screen

The SnarfOperation class uses NSURLConnection to download an image asynchronously. This exercise uses Objective-C 2.0 features and KVO notifications.
There are two other classes involved: ImageCanvas, which draws an array of images (fed by SnarfOperations), and AppController, which reads a text file of URLs and creates operations. All of these classes are shown in Figure 21.5.
Figure 21.5 ImageSnarfer ...
Read now
Unlock full access