NimbusKit
1.2.1 - Fork Nimbus on Github - Visit the Nimbus Wiki
The iOS framework that grows only as fast as its documentation
|
A general-purpose radio group.
This group object manages radio-style selection of objects. Only one object may be selected at a time.
Due to the general-purpose nature of this object, it can be used with UITableViews or any other view that has sets of objects being displayed. This object can insert itself into a UITableViewDelegate call chain to minimize the amount of code that needs to be written in your controller.
If you add a NIRadioGroup object to a NITableViewModel, it will show a cell that displays the current radio group selection. This cell is also tappable. Tapping this cell will push a controller onto the navigation stack that presents the radio group options for the user to select. The radio group delegate is notified immediately when a selection is made and the tapped cell is also updated to reflect the new selection.
Tasks | |
(Class) | - cellClass |
(UITableViewCellStyle) | - cellStyle |
Selection | |
NSInteger | selectedIdentifier property |
(BOOL) | - hasSelection |
(void) | - clearSelection |
Forwarding | |
UITableViewCellSelectionStyle | tableViewCellSelectionStyle property |
NSString * | cellTitle property |
NSString * | controllerTitle property |
(id< UITableViewDelegate >) | - forwardingTo: |
(void) | - removeForwarding: |
(NSArray *) | - allObjects |
Creating Radio Groups | |
(id) | - initWithController: |
Mapping Objects | |
(id) | - mapObject:toIdentifier: |
Object State | |
(BOOL) | - isObjectInRadioGroup: |
(BOOL) | - isObjectSelected: |
(NSInteger) | - identifierForObject: |
The currently selected identifier if one is selected, otherwise returns NSIntegerMin.
The cell selection style that will be applied to the cell when it is displayed using delegate forwarding.
By default this is UITableViewCellSelectionStyleBlue.
The title of the cell that is displayed for a radio group in a UITableView.
The title of the controller that shows the sub radio group selection.
Initializes a newly allocated radio group object with the given controller.
This is the designated initializer.
The given controller is stored as a weak reference internally.
controller | The controller that will be used when this object is used as a sub radio group. |
Maps the given object to the given identifier.
The identifier will be used in all subsequent operations and is a means of abstracting away the objects. The identifier range does not have to be sequential. The only reserved value is NSIntegerMin, which is used to signify that no selection exists.
You can NOT map the same object to multiple identifiers. Attempts to do so fill fire a debug assertion and will not map the new object in the radio group.
object | The object to map to the identifier. |
identifier | The identifier that will represent the object. |
Whether or not a selection has been made.
Removes the selection from this cell group.
Returns YES if the given object is in this radio group.
Returns YES if the given object is selected.
This method should only be called after verifying that the object is contained within the radio group with isObjectInRadioGroup:.
Returns the mapped identifier for this object.
This method should only be called after verifying that the object is contained within the radio group with isObjectInRadioGroup:.
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:
forwardDelegate | The delegate to forward invocations to. |
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.
forwardDelegate | The delegate to stop forwarding invocations to. |
An array of mapped objects in this radio group, ordered in the same order they were mapped.
This is used primarily by NIRadioGroupController to display the radio group options.
The class of cell to be created when this object is passed to the cell factory.
The style of UITableViewCell to be used when initializing the cell for the first time.