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

Overview

An object that can be used to easily implement actions in table view controllers.

This object provides support for the three primary types of actions that can be taken on cells in UITableViews:

  • Tapping a cell.
  • Tapping the details button.
  • Navigating from a cell.

This object will automatically apply the correct accessoryType and selectionStyle values to the cell when it is displayed. This allows you to write cells without any knowledge of "actions", greatly simplifying the logic that goes into your cells.

Definition at line 47 of file NITableViewActions.h.

Methods

Forwarding
UITableViewCellSelectionStyle tableViewCellSelectionStyle property
Creating Radio Groups
(id) - initWithController:
Mapping Objects
(id) - attachTapAction:toObject:
(id) - attachDetailAction:toObject:
(id) - attachNavigationAction:toObject:
Object State
(BOOL) - isObjectActionable:
Forwarding
(id< UITableViewDelegate >) - forwardingTo:
(void) - removeForwarding:

Method Documentation

- NITableViewActions: [read, write, assign]

The cell selection style that will be applied to the cell when it is displayed using delegate forwarding.

By default this is UITableViewCellSelectionStyleBlue.

Definition at line 64 of file NITableViewActions.h.

- (id) initWithController: (UIViewController *)  controller

Initializes a newly allocated radio group object with the given controller.

Initializes a newly allocated table view actions object with the given controller.

This is the designated initializer.

The given controller is stored as a weak reference internally.

Parameters:
controllerThe controller that will be used when this object is used as a sub radio group.

This is the designated initializer.

The given controller is stored as a weak reference internally.

Parameters:
controllerThe controller that will be used in action blocks.

Definition at line 58 of file NITableViewActions.m.

- (id) attachTapAction: (NITableViewActionBlock)  action
toObject: (id)  object 

Attaches a tap action to the given object.

When a cell with a tap action is displayed, its selectionStyle will be set to tableViewCellSelectionStyle.

When a cell with a tap action is tapped, the action block will be executed. If the action block returns YES then the cell will be deselected immediately after the block completes execution. If NO is returned then the selection will remain.

You should return NO if you use the tap action to present a modal view controller. This will ensure that the cell selection remains when the modal controller is dismissed, providing a visual cue to the user as to which cell was tapped.

If a navigation action also exists for this object then the tap action will be executed first, followed by the navigation action.

Parameters:
objectThe object to attach the action to.
actionThe tap action block.
Returns:
The object that you attached this action to.

Definition at line 156 of file NITableViewActions.m.

- (id) attachDetailAction: (NITableViewActionBlock)  action
toObject: (id)  object 

Attaches a detail action to the given object.

When a cell with a detail action is displayed, its accessoryType will be set to UITableViewCellAccessoryDetailDisclosureButton.

When a cell's detail button is tapped, the detail action block will be executed. The return value of the block is ignored.

Parameters:
objectThe object to attach the action to.
actionThe detail action block.
Returns:
The object that you attached this action to.

Definition at line 164 of file NITableViewActions.m.

- (id) attachNavigationAction: (NITableViewActionBlock)  action
toObject: (id)  object 

Attaches a navigation action to the given object.

When a cell with a navigation action is displayed, its accessoryType will be set to UITableViewCellAccessoryDisclosureIndicator if there is no detail action, otherwise the detail disclosure indicator takes precedence.

When a cell with a navigation action is tapped the navigation block will be executed.

If a tap action also exists for this object then the tap action will be executed first, followed by the navigation action.

Parameters:
objectThe object to attach the action to.
actionThe navigation action block.
Returns:
The object that you attached this action to.

Definition at line 172 of file NITableViewActions.m.

- (BOOL) isObjectActionable: (id)  object

Returns whether or not the object has any actions attached to it.

Definition at line 180 of file NITableViewActions.m.

- (id< UITableViewDelegate >) forwardingTo: (id<UITableViewDelegate>)  forwardDelegate

Sets the delegate that table view methods should be forwarded to.

This method allows you to insert the radio group into the call chain for the table view's delegate methods.

Example:

// Let the radio group handle delegate methods and then forward them to whatever delegate was
// already assigned.
self.tableView.delegate = [self.radioGroup forwardingTo:self.tableView.delegate];
Parameters:
forwardDelegateThe delegate to forward invocations to.
Returns:
self so that this method can be chained.

This method allows you to insert the actions into the call chain for the table view's delegate methods.

Example:

// Let the actions handle delegate methods and then forward them to whatever delegate was
// already assigned.
self.tableView.delegate = [self.actions forwardingTo:self.tableView.delegate];
Parameters:
forwardDelegateThe delegate to forward invocations to.
Returns:
self so that this method can be chained.

Definition at line 138 of file NITableViewActions.m.

- (void) removeForwarding: (id<UITableViewDelegate>)  forwardDelegate

Removes the delegate from the forwarding chain.

If a forwared delegate is about to be released but this object may live on, you must remove the forwarding in order to avoid invalid access errors at runtime.

Parameters:
forwardDelegateThe delegate to stop forwarding invocations to.

Definition at line 145 of file NITableViewActions.m.

Generated for Nimbus by doxygen 1.7.4-20110629