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

Overview

The cell that is displayed for a NIRadioGroup object when it is displayed in a UITableView.

This class is exposed publicly so that you may subclass it and customize the way it displays its information. You can override the cell class that the radio group uses in two ways:

  1. Subclass NIRadioGroup and return a different cell class in -cellClass.
  2. Create a NICellFactory and map NIRadioGroup to a different cell class and then use this factory for your model in your table view controller.

By default this cell displays the cellTitle property of the radio group on the left and the text retrieved from the radio group delegate's radioGroup:textForIdentifier: method on the right.

Inheritance diagram for NIRadioGroupCell:
<NICell>

Tasks

(BOOL) - shouldUpdateCellWithObject:
 
(BOOL) + shouldAppendObjectClassToReuseIdentifier
 
(CGFloat) + heightForObject:atIndexPath:tableView:
 

Method Documentation

shouldUpdateCellWithObject:

Called when a cell is created and reused.

- (BOOL)shouldUpdateCellWithObject:(id)object;
Discussion

Implement this method to customize the cell's properties for display using the given object.

shouldAppendObjectClassToReuseIdentifier

Asks the receiver whether the mapped object class should be appended to the reuse identifier in order to create a unique cell.object identifier key.

+ (BOOL)shouldAppendObjectClassToReuseIdentifier;
Discussion

This is useful when you have a cell that is intended to be used by a variety of different objects.

heightForObject:atIndexPath:tableView:

Asks the receiver to calculate its height.

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView;
Discussion

The following is an appropiate implementation in your tableView's delegate:

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat height = tableView.rowHeight;
id object = [(NITableViewModel *)tableView.dataSource objectAtIndexPath:indexPath];
id class = [object cellClass];
if ([class respondsToSelector:@selector(heightForObject:atIndexPath:tableView:)]) {
height = [class heightForObject:object atIndexPath:indexPath tableView:tableView];
}
return height;
}

You may also use the tableView:heightForRowAtIndexPath:model: methods on NICellFactory to achieve the same result. Using the above example allows you to customize the logic according to your specific needs.