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

Overview

A single page in a launcher view.

This is a recyclable page view that can be used with NIPagingScrollView.

Each launcher page contains a set of views. The page lays out each of the views in a grid based on the given display attributes.

Views will be laid out from left to right and then from top to bottom.

Inheritance diagram for NILauncherPageView:
NIPagingScrollViewPage NIRecyclableView <NIPagingScrollViewPage> <NIRecyclableView> <NIRecyclableView>

Tasks

NSString * reuseIdentifier property
 
(id) - initWithReuseIdentifier:
 
(void) - prepareForReuse
 
(void) - pageDidDisappear
 
(void) - setFrameAndMaintainState:
 
Recyclable Views
NIViewRecyclerviewRecycler property
 
NSArray * recyclableViews property
 
(void) - addRecyclableView:
 
Configuring Display Attributes
UIEdgeInsets contentInset property
 
CGSize viewSize property
 
CGSize viewMargins property
 

Method Documentation

viewRecycler

A shared view recycler for this page's recyclable views.

@property (nonatomic, strong) NIViewRecycler* viewRecycler;
Discussion

When this page view is preparing for reuse it will add each of its button views to the recycler. This recycler should be the same recycler used by all pages in the launcher view.

recyclableViews

All of the recyclable views that have been added to this page.

@property (nonatomic, readonly, strong) NSArray* recyclableViews;
Discussion
Returns
An array of recyclable views in the same order in which they were added.

contentInset

The distance that the recyclable views are inset from the enclosing view.

@property (nonatomic) UIEdgeInsets contentInset;
Discussion

Use this property to add to the area around the content. The unit of size is points. The default value is UIEdgeInsetsZero.

viewSize

The size of each recyclable view.

@property (nonatomic) CGSize viewSize;
Discussion

The unit of size is points. The default value is CGSizeZero.

viewMargins

The recommended horizontal and vertical distance between each recyclable view.

@property (nonatomic) CGSize viewMargins;
Discussion

This property is only a recommended value because the page view does its best to distribute the views in a way that visually balances them.

Width is the horizontal distance between each view. Height is the vertical distance between each view. The unit of size is points. The default value is CGSizeZero.

addRecyclableView:

Add a recyclable view to this page.

- (void)addRecyclableView:(UIView<NIRecyclableView> *)view;
Discussion
Parameters
viewA recyclable view.

reuseIdentifier

This view's reuse identifier.

@property (nonatomic, copy) NSString* reuseIdentifier;
Discussion

Used by NIViewRecycler to pool this view into a group of similar recycled views.

initWithReuseIdentifier:

Initializes a newly allocated view with the given reuse identifier.

- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;
Discussion

This is the designated initializer.

Parameters
reuseIdentifierThe identifier that will be used to group this view in the view recycler.

prepareForReuse

Called immediately after the view has been dequeued from the recycled view pool.

- (void)prepareForReuse;

pageDidDisappear

Called after the page has gone off-screen.

- (void)pageDidDisappear;
Discussion

This method should be used to reset any state information after a page goes off-screen. For example, in the Nimbus photo viewer we reset the zoom scale so that if the photo was zoomed in it will fit on the screen again when the user flips back and forth between two pages.

setFrameAndMaintainState:

Called when the frame of the page is going to change.

- (void)setFrameAndMaintainState:(CGRect)frame;
Discussion

Use this method to maintain any state that may be affected by the frame changing. The Nimbus photo viewer uses this method to save and restore the zoom and center point. This makes the photo always appear to rotate around the center point of the screen rather than the center of the photo.