Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).
NIPhotoAlbumScrollView Class Reference

Overview

A paged scroll view that shows a collection of photos.

This view provides a light-weight implementation of a photo viewer, complete with pinch-to-zoom and swiping to change photos. It is designed to perform well with large sets of photos and large images that are loaded from either the network or disk.

It is intended for this view to be used in conjunction with a view controller that implements the data source protocol and presents any required chrome.

See also:
NIToolbarPhotoViewController

Definition at line 41 of file NIPhotoAlbumScrollView.h.

Inheritance diagram for NIPhotoAlbumScrollView:
NIPagingScrollView <NIPhotoScrollViewDelegate>

Methods

Data Source
id
< NIPhotoAlbumScrollViewDataSource
dataSource property
id
< NIPhotoAlbumScrollViewDelegate
delegate property
Configuring Functionality
BOOL zoomingIsEnabled property
BOOL zoomingAboveOriginalSizeIsEnabled property
UIColor * photoViewBackgroundColor property
Configuring Presentation
UIImage * loadingImage property
Notifying the View of Loaded Photos
(void) - didLoadPhoto:atIndex:photoSize:
State
NSInteger centerPageIndex property
NSInteger numberOfPages property
(void) - setCenterPageIndex:animated:
Configuring Presentation
CGFloat pageHorizontalMargin property
Subclassing
UIScrollView * pagingScrollView property
NSMutableSet * visiblePages property
(void) - willDisplayPage:
(void) - didRecyclePage:
Data Source
(void) - reloadData
(UIView
< NIPagingScrollViewPage > *) 
- dequeueReusablePageWithIdentifier:
Changing the Visible Page
(BOOL) - hasNext
(BOOL) - hasPrevious
(void) - moveToNextAnimated:
(void) - moveToPreviousAnimated:
(void) - moveToPageAtIndex:animated:
Rotating the Scroll View
(void) - willRotateToInterfaceOrientation:duration:
(void) - willAnimateRotationToInterfaceOrientation:duration:
[NIPhotoScrollViewDelegate] Zooming
(void) - photoScrollViewDidDoubleTapToZoom:didZoomIn:

Method Documentation

- (id< NIPhotoAlbumScrollViewDataSource >) dataSource [read, write, assign]

The data source for this photo album view.

This is the only means by which this photo album view acquires any information about the album to be displayed.

Reimplemented from NIPagingScrollView.

Definition at line 54 of file NIPhotoAlbumScrollView.h.

- (id< NIPhotoAlbumScrollViewDelegate >) delegate [read, write, assign]

The delegate for this photo album view.

Any user interactions or state changes are sent to the delegate through this property.

Reimplemented from NIPagingScrollView.

Definition at line 55 of file NIPhotoAlbumScrollView.h.

- NIPhotoAlbumScrollView: [read, write, assign]

Whether zooming is enabled or not.

Regardless of whether this is enabled, only original-sized images will be zoomable. This is because we often don't know how large the final image is so we can't calculate min and max zoom amounts correctly.

By default this is YES.

Definition at line 59 of file NIPhotoAlbumScrollView.h.

- NIPhotoAlbumScrollView: [read, write, assign]

Whether small photos can be zoomed at least until they fit the screen.

See also:
NIPhotoScrollView::zoomingAboveOriginalSizeIsEnabled

By default this is YES.

Definition at line 60 of file NIPhotoAlbumScrollView.h.

- NIPhotoAlbumScrollView: [read, write, retain]

The background color of each photo's view.

By default this is [UIColor blackColor].

Definition at line 61 of file NIPhotoAlbumScrollView.h.

- NIPhotoAlbumScrollView: [read, write, retain]

An image that is displayed while the photo is loading.

This photo will be presented if no image is returned in the data source's implementation of photoAlbumScrollView:photoAtIndex:photoSize:isLoading:.

Zooming is disabled when showing a loading image, regardless of the state of zoomingIsEnabled.

By default this is nil.

Definition at line 65 of file NIPhotoAlbumScrollView.h.

- (void) didLoadPhoto: (UIImage *)  image
atIndex: (NSInteger)  photoIndex
photoSize: (NIPhotoScrollViewPhotoSize)  photoSize 

Notify the scroll view that a photo has been loaded at a given index.

You should notify the completed loading of thumbnails as well. Calling this method is fairly lightweight and will only update the images of the visible pages. Err on the side of calling this method too much rather than too little.

The photo at the given index will only be replaced with the given image if photoSize is of a higher quality than the currently-displayed photo's size.

Definition at line 175 of file NIPhotoAlbumScrollView.m.

- NIPagingScrollView: [read, write, assign, inherited]

The current center page index.

This is a zero-based value. If you intend to use this in a label such as "page ## of n" be sure to add one to this value.

Setting this value directly will center the new page without any animation.

Definition at line 81 of file NIPagingScrollView.h.

- NIPagingScrollView: [read, assign, inherited]

The total number of pages in this paging view, as gathered from the data source.

This value is cached after reloadData has been called.

Until reloadData is called the first time, numberOfPages will be NIPagingScrollViewUnknownNumberOfPages.

Definition at line 84 of file NIPagingScrollView.h.

- NIPagingScrollView: [read, write, assign, inherited]

The number of pixels on either side of each page.

The space between each page will be 2x this value.

By default this is NIPagingScrollViewDefaultPageHorizontalMargin.

Definition at line 88 of file NIPagingScrollView.h.

- NIPagingScrollView: [read, retain, inherited]

The internal scroll view.

Meant to be used by subclasses only.

Definition at line 105 of file NIPagingScrollView.h.

- NIPagingScrollView: [read, copy, inherited]

The set of currently visible pages.

Meant to be used by subclasses only.

Definition at line 106 of file NIPagingScrollView.h.

- (void) reloadData

Force the view to reload its data by asking the data source for information.

This must be called at least once after dataSource has been set in order for the view to gather any presentable information.

This method is cheap because we only fetch new information about the currently displayed pages. If the number of pages shrinks then the current center page index will be decreased accordingly.

Definition at line 474 of file NIPagingScrollView.m.

- (UIView< NIPagingScrollViewPage > *) dequeueReusablePageWithIdentifier: (NSString *)  identifier

Dequeues a reusable page from the set of recycled pages.

If no pages have been recycled for the given identifier then this will return nil. In this case it is your responsibility to create a new page.

Definition at line 247 of file NIPagingScrollView.m.

- (void) setCenterPageIndex: (NSInteger)  centerPageIndex
animated: (BOOL)  __NI_DEPRECATED_METHOD 

Change the center page index with optional animation.

This method is deprecated in favor of moveToPageAtIndex:animated:

Definition at line 654 of file NIPagingScrollView.m.

- (BOOL) hasNext

Returns YES if there is a next page.

Definition at line 567 of file NIPagingScrollView.m.

- (BOOL) hasPrevious

Returns YES if there is a previous page.

Definition at line 573 of file NIPagingScrollView.m.

- (void) moveToNextAnimated: (BOOL)  animated

Move to the next page if there is one.

Definition at line 628 of file NIPagingScrollView.m.

- (void) moveToPreviousAnimated: (BOOL)  animated

Move to the previous page if there is one.

Definition at line 638 of file NIPagingScrollView.m.

- (void) moveToPageAtIndex: (NSInteger)  pageIndex
animated: (BOOL)  animated 

Move to the given page index with optional animation.

Definition at line 596 of file NIPagingScrollView.m.

- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation)  toInterfaceOrientation
duration: (NSTimeInterval)  duration 

Stores the current state of the scroll view in preparation for rotation.

This must be called in conjunction with willAnimateRotationToInterfaceOrientation:duration: in the methods by the same name from the view controller containing this view.

Definition at line 523 of file NIPagingScrollView.m.

- (void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)  toInterfaceOrientation
duration: (NSTimeInterval)  duration 

Updates the frame of the scroll view while maintaining the current visible page's state.

Definition at line 545 of file NIPagingScrollView.m.

- (void) willDisplayPage: (UIView<NIPagingScrollViewPage> *)  pageView

Called before the page is about to be shown and after its frame has been set.

Meant to be subclassed. By default this method does nothing.

Definition at line 456 of file NIPagingScrollView.m.

- (void) didRecyclePage: (UIView<NIPagingScrollViewPage> *)  pageView

Called immediately after the page is removed from the paging scroll view.

Meant to be subclassed. By default this method does nothing.

Definition at line 462 of file NIPagingScrollView.m.

- (void) photoScrollViewDidDoubleTapToZoom: (NIPhotoScrollView *)  photoScrollView
didZoomIn: (BOOL)  didZoomIn 

The user has double-tapped the photo to zoom either in or out.

Parameters:
photoScrollViewThe photo scroll view that was tapped.
didZoomInYES if the photo was zoomed in. NO if the photo was zoomed out.
Generated for Nimbus by doxygen 1.7.4-20110629