The iOS framework that grows only as fast as its documentation
Nimbus Photos

Classes

class  NIPhotoAlbumScrollView
 A paged scroll view that shows a collection of photos. More...
 
protocol  <NIPhotoAlbumScrollViewDataSource>
 The photo album scroll data source. More...
 
class  NIPhotoScrollView
 A single photo view that supports zooming and rotation. More...
 
protocol  <NIPhotoScrollViewDelegate>
 The photo scroll view delegate. More...
 
class  NIPhotoScrubberView
 A control built for quickly skimming through a collection of images. More...
 
protocol  <NIPhotoScrubberViewDataSource>
 The data source for the photo scrubber. More...
 
protocol  <NIPhotoScrubberViewDelegate>
 The delegate for the photo scrubber. More...
 
class  NIToolbarPhotoViewController
 A simple photo album view controller implementation with a toolbar. More...
 

Overview

Photo viewers are a common, non-trivial feature in many types of iOS apps ranging from simple photo viewers to apps that fetch photos from an API. The Nimbus photo album viewer is designed to consume minimal amounts of memory and encourage the use of threads to provide a high quality user experience that doesn't include any blocking of the UI while images are loaded from disk or the network. The photo viewer pre-caches images in an album to either side of the current image so that the user will ideally always have a high-quality photo experience.

Adding the Photos Feature to Your Application

The Nimbus Photos feature uses a small number of custom photos that are stored in the NimbusPhotos bundle. You must add this bundle to your application, ensuring that you select the "Create Folder References" option and that the bundle is copied in the "Copy Bundle Resources" phase.

The bundle can be found at src/photos/resources/NimbusPhotos.bundle.

Feature Breakdown

NIPhotoAlbumScrollView - A paged scroll view that implements a data source similar to that of UITableView. This scroll view consumes minimal amounts of memory and is built to be fast and responsive.

NIPhotoScrollView - A single page within the NIPhotoAlbumScrollView. This view implements the zooming and rotation functionality for a photo.

NIPhotoScrubberView - A scrubber view for skimming through a set of photos. This view made its debut by Apple on the iPad in Photos.app. Nimbus' implementation of this view is built to be responsive and consume little memory.

NIToolbarPhotoViewController - A skeleton implementation of a view controller that includes multiple configurable properties. This controller will show a scrubber on the iPad and next/previous arrows on the iPhone. It also provides support for hiding and showing the app's chrome. If you wish to use this controller you must simply implement the data source for the photo album. NetworkPhotoAlbum in the examples/photos directory demos building a data source that fetches its information from the network.

Architecture

The architectural design of the photo album view takes inspiration from UITableView. Images are requested only when they might become visible and are released when they become inaccessible again. Each page of the photo album view is a recycled NIPhotoScrollView. These page views handle zooming and panning within a given photo. The photo album view NIPhotoAlbumScrollView contains a paging scroll view of these page views and provides interfaces for maintaining the orientation during rotations.

The view controller NIToolbarPhotoViewController is provided as a basic implementation of functionality that is expected from a photo viewer. This includes: a toolbar with next and previous arrows; auto-rotation support; and toggling the chrome.

NIPhotoAlbumScrollView

NIPhotoAlbumScrollView is the meat of the Nimbus photo viewer's functionality. Contained within this view are pages of NIPhotoScrollView views. In your view controller you are expected to implement the NIPhotoAlbumScrollViewDataSource in order to provide the photo album view with the necessary information for presenting an album.

Example Applications

Network Photo Albums

View the README on GitHub

This sample application demos the use of the multiple photo APIs to fetch photos from public photo album and display them in high-definition on the iPad and iPhone.

The following APIs are currently demoed:

Sample location: examples/photos/NetworkPhotoAlbums

Screenshots

photos-iphone-example1.png
Screenshot of a basic photo album on the iPhone.

Image source: flickr.com/photos/janekm/360669001