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

Overview

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>

Tasks

Configuring Functionality
BOOL toolbarIsTranslucent property
 
BOOL hidesChromeWhenScrolling property
 
BOOL chromeCanBeHidden property
 
BOOL animateMovingToNextAndPreviousPhotos property
 
BOOL scrubberIsEnabled property
 
Views
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

toolbarIsTranslucent

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

@property (nonatomic) BOOL toolbarIsTranslucent;
Discussion

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.

hidesChromeWhenScrolling

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

@property (nonatomic) BOOL hidesChromeWhenScrolling;
Discussion

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.

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

chromeCanBeHidden

Whether or not to allow hiding the chrome.

@property (nonatomic) BOOL chromeCanBeHidden;
Discussion

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.

Attention
Setting this to NO will also disable hidesToolbarWhenScrolling.

animateMovingToNextAndPreviousPhotos

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

@property (nonatomic) BOOL animateMovingToNextAndPreviousPhotos;
Discussion

By default this is NO.

scrubberIsEnabled

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

@property (nonatomic) BOOL scrubberIsEnabled;
Discussion

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

toolbar

The toolbar view.

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

photoAlbumView

The photo album view.

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

photoScrubberView

The photo scrubber view.

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

nextButton

The 'next' button.

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

previousButton

The 'previous' button.

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

photoAlbumScrollView:didZoomIn:

The user double-tapped to zoom in or out.

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

photoAlbumScrollViewDidLoadNextPhoto:

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

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

photoAlbumScrollViewDidLoadPreviousPhoto:

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

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

pagingScrollViewDidScroll:

The user is scrolling between two photos.

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

pagingScrollViewWillChangePages:

The current page will change.

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

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

pagingScrollViewDidChangePages:

The current page has changed.

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

pagingScrollView.centerPageIndex will reflect the changed page index.

photoScrubberViewDidChangeSelection:

The photo scrubber changed its selection.

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

Use photoScrubberView.selectedPhotoIndex to access the current selection.