Overview

Image views that load images from the network and efficiently store the result in memory and on disk.

Presented below is an architectural overview of the Nimbus network image library.

NINetworkImage Design

To begin using a network image view, simply create an instance of an NINetworkImageView and use it as you would a UIImageView. The initial image you assign to the view will be used as the "loading" image and must be a locally accessible image. Note that this image will not be cropped and resized in any way, so you should take care to crop and resize it beforehand as necessary.

Once you have created your network image view and assigned the initial image, the next step is to load the network image. Call any of the setPathToNetworkImage methods to fire off a network request for the image on a separate thread.

Once the image has been retrieved from the net, the thread crops and resizes the image depending on the presentation configurations specified by the image view. In this example, sizeForDisplay and cropImageForDisplay are enabled. In this step the image is resized to fit the aspect ratio of the display size.

We then crop the image to fit the display frame.

Upon completion of all image modifications, we complete the request and return only the modified image to the image view. This helps to reduce memory usage.

The resized and cropped image is then stored in the in-memory image cache for quick access in the future.