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

Overview

A launcher view model that complies to the NILauncherDataSource protocol.

This model object allows you to keep all of your launcher view data together in one object. It also conforms to the NSCoding protocol, allowing you to read and write your model to disk so that you can store the state of your launcher.

Inheritance diagram for NILauncherViewModel:
<NILauncherDataSource>

Tasks

Creating Launcher View Models
(id) - initWithArrayOfPages:delegate:
 
Accessing Objects
(void) - appendPage:
 
(void) - appendObject:toPage:
 
(id< NILauncherViewObject >) - objectAtIndex:pageIndex:
 
Configuring a Launcher View
(NSInteger) - launcherView:numberOfButtonsInPage:
 
(UIView< NILauncherButtonView > *) - launcherView:buttonViewForPage:atIndex:
 
(NSInteger) - numberOfPagesInLauncherView:
 
(NSInteger) - numberOfRowsPerPageInLauncherView:
 
(NSInteger) - numberOfColumnsPerPageInLauncherView:
 

Method Documentation

initWithArrayOfPages:delegate:

Initializes a newly allocated launcher view model with an array of pages and a given delegate.

- (id)initWithArrayOfPages:(NSArray *)pages delegate:(id<NILauncherViewModelDelegate>)delegate;
Discussion

This is the designated initializer.

Parameters
pagesAn array of arrays of objects that conform to the NILauncherViewObject protocol.
delegateAn object that conforms to the NILauncherViewModelDelegate protocol.
Returns
An initialized launcher view model.

appendPage:

Appends a page of launcher view objects.

- (void)appendPage:(NSArray *)page;
Discussion
Parameters
pageAn array of launcher view objects to add.

appendObject:toPage:

Appends a launcher view object to a given page.

- (void)appendObject:(id<NILauncherViewObject>)object toPage:(NSInteger)pageIndex;
Discussion
Parameters
objectThe object to add to the page.
pageIndexThe index of the page to add this object to.

objectAtIndex:pageIndex:

Returns the object at the given index in the page at the given page index.

- (id<NILauncherViewObject>)objectAtIndex:(NSInteger)index pageIndex:(NSInteger)pageIndex;
Discussion

Throws an assertion if the object index or page index are out of bounds.

Parameters
indexThe index within the page of the object to return.
pageIndexThe index of the page to retrieve the object from.
Returns
An object from a specific page.

launcherView:numberOfButtonsInPage:

Tells the receiver to return the number of rows in a given section of a table view (required).

- (NSInteger)launcherView:(NILauncherView *)launcherView numberOfButtonsInPage:(NSInteger)page;
Discussion
Parameters
launcherViewThe launcher-view object requesting this information.
pageThe index locating a page in launcherView.
Returns
The number of buttons in page.

launcherView:buttonViewForPage:atIndex:

Tells the receiver to return a button view for inserting into a particular location of a given page in the launcher view (required).

- (UIView<NILauncherButtonView>*)launcherView:(NILauncherView *)launcherView buttonViewForPage:(NSInteger)page atIndex:(NSInteger)index;
Discussion
Parameters
launcherViewThe launcher-view object requesting this information.
pageThe index locating a page in launcherView.
indexThe index locating a button in a page.
Returns
A UIView that conforms to NILauncherButtonView that the launcher will display on the given page. An assertion is raised if you return nil.

numberOfPagesInLauncherView:

Asks the receiver to return the number of pages in the launcher view.

- (NSInteger)numberOfPagesInLauncherView:(NILauncherView *)launcherView;
Discussion

It is assumed that the launcher view has one page if this method is not implemented.

Parameters
launcherViewThe launcher-view object requesting this information.
Returns
The number of pages in launcherView. The default value is 1.
See Also
- launcherView:numberOfButtonsInPage:

numberOfRowsPerPageInLauncherView:

Asks the receiver to return the number of rows of buttons each page can display in the launcher view.

- (NSInteger)numberOfRowsPerPageInLauncherView:(NILauncherView *)launcherView;
Discussion

This method will be called each time the frame of the launcher view changes. Notably, this will be called when the launcher view has been rotated as a result of a device rotation.

Parameters
launcherViewThe launcher-view object requesting this information.
Returns
The number of rows of buttons each page can display.
See Also
- numberOfColumnsPerPageInLauncherView:

numberOfColumnsPerPageInLauncherView:

Asks the receiver to return the number of columns of buttons each page can display in the launcher view.

- (NSInteger)numberOfColumnsPerPageInLauncherView:(NILauncherView *)launcherView;
Discussion

This method will be called each time the frame of the launcher view changes. Notably, this will be called when the launcher view has been rotated as a result of a device rotation.

Parameters
launcherViewThe launcher-view object requesting this information.
Returns
The number of columns of buttons each page can display.
See Also
- numberOfRowsPerPageInLauncherView: