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.
- 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.
- A new NINetworkImageRequest thread will spin off and initiate the request to the network.
- 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.
- At last, the image view sets the new image and displays it.
BasicNetworkImage - Demos each of the image content modes. [README]
This demo sets up a scroll view of network images that each show a different UIViewContentMode of the same image. The in-memory cache size is also displayed as the images are loaded.
Screenshots of the BasicNetworkImage demo application.