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

Overview

The photo album scroll data source.

This data source emphasizes speed and memory efficiency by requesting images only when they're needed and encouraging immediate responses from the data source implementation.

See also:
NIPhotoAlbumScrollView

Definition at line 35 of file NIPhotoAlbumScrollViewDataSource.h.

Inheritance diagram for <NIPhotoAlbumScrollViewDataSource>:
<NIPagingScrollViewDataSource>

Methods

[NIPhotoAlbumScrollViewDataSource] Fetching Required Album Information
(UIImage *) - photoAlbumScrollView:photoAtIndex:photoSize:isLoading:originalPhotoDimensions:
[NIPhotoAlbumScrollViewDataSource] Optimizing Data Retrieval
(void) - photoAlbumScrollView:stopLoadingPhotoAtIndex:
[NIPagingScrollViewDataSource] Fetching Required Album Information
(NSInteger) - numberOfPagesInPagingScrollView:
(UIView
< NIPagingScrollViewPage > *) 
- pagingScrollView:pageViewForIndex:

Method Documentation

- (UIImage *) photoAlbumScrollView: (NIPhotoAlbumScrollView *)  photoAlbumScrollView
photoAtIndex: (NSInteger)  photoIndex
photoSize: (NIPhotoScrollViewPhotoSize *)  photoSize
isLoading: (BOOL *)  isLoading
originalPhotoDimensions: (CGSize *)  originalPhotoDimensions 

Fetches the highest-quality image available for the photo at the given index.

Your goal should be to make this implementation return as fast as possible. Avoid hitting the disk or blocking on a network request. Aim to load images asynchronously.

If you already have the highest-quality image in memory (like in an NIImageMemoryCache), then you can simply return the image and set photoSize to be NIPhotoScrollViewPhotoSizeOriginal.

If the highest-quality image is not available when this method is called then you should spin off an asynchronous operation to load the image and set isLoading to YES.

If you have a thumbnail in memory but not the full-size image yet, then you should return the thumbnail, set isLoading to YES, and set photoSize to NIPhotoScrollViewPhotoSizeThumbnail.

Once the high-quality image finishes loading, call didLoadPhoto:atIndex:photoSize: with the image.

This method will be called to prefetch the next and previous photos in the scroll view. The currently displayed photo will always be requested first.

Attention:
The photo scroll view does not hold onto the UIImages for very long at all. It is up to the controller to decide on an adequate caching policy to ensure that images are kept in memory through the life of the photo album. In your implementation of the data source you should prioritize thumbnails being kept in memory over full-size images. When a memory warning is received, the original photos should be relinquished from memory first.
- (void) photoAlbumScrollView: (NIPhotoAlbumScrollView *)  photoAlbumScrollView
stopLoadingPhotoAtIndex: (NSInteger)  photoIndex 

Called when you should cancel any asynchronous loading requests for the given photo.

When a photo is not immediately visible this method is called to allow the data source to minimize the number of active asynchronous operations in place.

This method is optional, though recommended because it focuses the device's processing power on the most immediately accessible photos.

- (NSInteger) numberOfPagesInPagingScrollView: (NIPagingScrollView *)  pagingScrollView

Fetches the total number of pages in the scroll view.

The value returned in this method will be cached by the scroll view until reloadData is called again.

- (UIView<NIPagingScrollViewPage> *) pagingScrollView: (NIPagingScrollView *)  pagingScrollView
pageViewForIndex: (NSInteger)  pageIndex 

Fetches a page that will be displayed at the given page index.

You should always try to reuse pages by calling dequeueReusablePageWithIdentifier: on the paging scroll view before allocating a new page.

Generated for Nimbus by doxygen 1.7.4-20110629