The iOS framework that grows only as fast as its documentation
NIToolbarPhotoViewController Class Reference


A simple photo album view controller implementation with a toolbar.

This controller does not implement the photo album data source, it simply implements some of the most common UI elements that are associated with a photo viewer.

For an example of implementing the data source, see the photos examples in the examples directory.

Implementing Delegate Methods

This view controller already implements NIPhotoAlbumScrollViewDelegate. If you want to implement methods of this delegate you should take care to call the super implementation if necessary. The following methods have implementations in this class:

  • photoAlbumScrollViewDidScroll:
  • photoAlbumScrollView:didZoomIn:
  • photoAlbumScrollViewDidChangePages:

Recommended Configurations

Default: Zooming enabled with translucent toolbar

The default settings are good for showing a photo album that takes up the entire screen. The photos will be visible beneath the toolbar because it is translucent. The chrome will be hidden whenever the user starts interacting with the photos.

Zooming disabled with opaque toolbar

The following settings are good for viewing photo albums when you want to keep the chrome visible at all times without zooming enabled.

Inheritance diagram for NIToolbarPhotoViewController:
<NIPhotoAlbumScrollViewDelegate> <NIPhotoScrubberViewDelegate> <NIPagingScrollViewDelegate>


Configuring Functionality
BOOL toolbarIsTranslucent property
BOOL hidesChromeWhenScrolling property
BOOL chromeCanBeHidden property
BOOL animateMovingToNextAndPreviousPhotos property
BOOL scrubberIsEnabled property
UIToolbar * toolbar property
NIPhotoAlbumScrollViewphotoAlbumView property
NIPhotoScrubberViewphotoScrubberView property
Toolbar Buttons
UIBarButtonItem * nextButton property
UIBarButtonItem * previousButton property
[NIPhotoAlbumScrollViewDelegate] Scrolling and Zooming
(void) - photoAlbumScrollView:didZoomIn:
[NIPhotoAlbumScrollViewDelegate] Data Availability
(void) - photoAlbumScrollViewDidLoadNextPhoto:
(void) - photoAlbumScrollViewDidLoadPreviousPhoto:
[NIPhotoAlbumScrollViewDelegate] Scrolling and Zooming
(void) - pagingScrollViewDidScroll:
[NIPagingScrollViewDelegate] Changing Pages
(void) - pagingScrollViewWillChangePages:
(void) - pagingScrollViewDidChangePages:
Selection Changes
(void) - photoScrubberViewDidChangeSelection:

Method Documentation


Whether the toolbar is translucent and shows photos beneath it or not.

@property (nonatomic) BOOL toolbarIsTranslucent;

If this is enabled, the toolbar will be translucent and the photo view will take up the entire view controller's bounds.

If this is disabled, the photo will only occupy the remaining space above the toolbar. The toolbar will also not be hidden when the chrome is dismissed. This is by design because dismissing the toolbar when photos can't be displayed beneath it would leave an empty space below the album.

By default this is YES.


Whether or not to hide the chrome when the user begins interacting with the photo.

@property (nonatomic) BOOL hidesChromeWhenScrolling;

If this is enabled, then the chrome will be hidden when the user starts swiping from one photo to another.

The chrome is the toolbar and the system status bar.

By default this is YES.

This will be set to NO if toolbarCanBeHidden is set to NO.


Whether or not to allow hiding the chrome.

@property (nonatomic) BOOL chromeCanBeHidden;

If this is enabled then the user will be able to single-tap to dismiss or show the toolbar.

The chrome is the toolbar and the system status bar.

If this is disabled then the chrome will always be visible.

By default this is YES.

Setting this to NO will also disable hidesToolbarWhenScrolling.


Whether to animate moving to a next or previous photo when the user taps the button.

@property (nonatomic) BOOL animateMovingToNextAndPreviousPhotos;

By default this is NO.


Whether to show a scrubber in the toolbar instead of next/previous buttons.

@property (nonatomic) BOOL scrubberIsEnabled;

By default this is YES on the iPad and NO on the iPhone.


The toolbar view.

@property (nonatomic, readonly, strong) UIToolbar* toolbar;


The photo album view.

@property (nonatomic, readonly, strong) NIPhotoAlbumScrollView* photoAlbumView;


The photo scrubber view.

@property (nonatomic, readonly, strong) NIPhotoScrubberView* photoScrubberView;


The 'next' button.

@property (nonatomic, readonly, strong) UIBarButtonItem* nextButton;


The 'previous' button.

@property (nonatomic, readonly, strong) UIBarButtonItem* previousButton;


The user double-tapped to zoom in or out.

- (void)photoAlbumScrollView:(NIPhotoAlbumScrollView *)photoAlbumScrollView didZoomIn:(BOOL)didZoomIn;


The next photo in the album has been loaded and is ready to be displayed.

- (void)photoAlbumScrollViewDidLoadNextPhoto:(NIPhotoAlbumScrollView *)photoAlbumScrollView;


The previous photo in the album has been loaded and is ready to be displayed.

- (void)photoAlbumScrollViewDidLoadPreviousPhoto:(NIPhotoAlbumScrollView *)photoAlbumScrollView;


The user is scrolling between two photos.

- (void)pagingScrollViewDidScroll:(NIPagingScrollView *)pagingScrollView;


The current page will change.

- (void)pagingScrollViewWillChangePages:(NIPagingScrollView *)pagingScrollView;

pagingScrollView.centerPageIndex will reflect the old page index, not the new page index.


The current page has changed.

- (void)pagingScrollViewDidChangePages:(NIPagingScrollView *)pagingScrollView;

pagingScrollView.centerPageIndex will reflect the changed page index.


The photo scrubber changed its selection.

- (void)photoScrubberViewDidChangeSelection:(NIPhotoScrubberView *)photoScrubberView;

Use photoScrubberView.selectedPhotoIndex to access the current selection.