RKAbstractTableController Class Reference
Inherits from | NSObject |
Conforms to | UITableViewDataSource UITableViewDelegate |
Declared in | RKAbstractTableController.h RKAbstractTableController.m |
Overview
RestKit’s table view abstraction leverages the object mapping engine to transform local objects into UITableViewCell representations. The table view model encapsulates the functionality of a UITableView dataSource and delegate into a single reusable component.
Tasks
Object to Table View Cell Mappings
-
– indexPathForObject:
Return the index path of the object within the table
RESTful Table Loading
-
objectManager
The object manager instance this table view model is associated with.
property
Model State Views
-
imageForEmpty
An image to overlay onto the table when the table view does not have any row data to display. It will be centered within the table view
property -
imageForError
An image to overlay onto the table when a load operation has encountered an error. It will be centered within the table view.
property -
imageForOffline
An image to overlay onto the table with when the user does not have connectivity to the Internet
property -
loadingView
A UIView to add to the table overlay during loading. It will be positioned directly in the center of the table view.
property -
overlayFrame
A rectangle configuring the dimensions for the overlay view that is applied to the table view during display of the loading view and state overlay images (offline/error/empty). By default, the overlay view will be auto-sized to cover the entire table. This can result in an inaccessible table UI if you have embedded controls within the header or footer views of your table. You can adjust the frame of the overlay precisely by configuring the overlayFrame property.
property -
showsOverlayImagesModally
When YES, the image view added to the table overlay for displaying table state (i.e. for offline, error and empty) will be displayed modally and prevent any interaction with the table.
property
Managing Sections
-
sectionCount
The number of sections in the model.
property -
rowCount
The number of rows across all sections in the model.
property -
– sectionAtIndex:
Returns the section at the specified index.
-
– sectionWithHeaderTitle:
Returns the first section with the specified header title.
-
– indexForSection:
Returns the index of the specified section.
-
– cellForObjectAtIndexPath:
Returns the UITableViewCell created by applying the specified mapping operation to the object identified by indexPath.
Other Methods
-
– didFinishLoad
Must be invoked when the table controller has finished loading.
Properties
imageForEmpty
An image to overlay onto the table when the table view does not have any row data to display. It will be centered within the table view
@property (nonatomic, retain) UIImage *imageForEmpty
Declared In
RKAbstractTableController.h
imageForError
An image to overlay onto the table when a load operation has encountered an error. It will be centered within the table view.
@property (nonatomic, retain) UIImage *imageForError
Declared In
RKAbstractTableController.h
imageForOffline
An image to overlay onto the table with when the user does not have connectivity to the Internet
@property (nonatomic, retain) UIImage *imageForOffline
See Also
Declared In
RKAbstractTableController.h
loadingView
A UIView to add to the table overlay during loading. It will be positioned directly in the center of the table view.
@property (nonatomic, retain) UIView *loadingView
Discussion
The loading view is always presented non-modally.
Declared In
RKAbstractTableController.h
objectManager
The object manager instance this table view model is associated with.
@property (nonatomic, assign) RKObjectManager *objectManager
Discussion
This instance is used for creating object loaders when loading Network tables and provides the managed object store used for Core Data tables. Online/offline state is also determined by watching for reachability notifications generated from the object manager.
Default: The shared manager instance [RKObjectManager sharedManager]
Declared In
RKAbstractTableController.h
overlayFrame
A rectangle configuring the dimensions for the overlay view that is applied to the table view during display of the loading view and state overlay images (offline/error/empty). By default, the overlay view will be auto-sized to cover the entire table. This can result in an inaccessible table UI if you have embedded controls within the header or footer views of your table. You can adjust the frame of the overlay precisely by configuring the overlayFrame property.
@property (nonatomic, assign) CGRect overlayFrame
Declared In
RKAbstractTableController.h
rowCount
The number of rows across all sections in the model.
@property (nonatomic, readonly) NSUInteger rowCount
Declared In
RKAbstractTableController.h
sectionCount
The number of sections in the model.
@property (nonatomic, readonly) NSUInteger sectionCount
Declared In
RKAbstractTableController.h
showsOverlayImagesModally
When YES, the image view added to the table overlay for displaying table state (i.e. for offline, error and empty) will be displayed modally and prevent any interaction with the table.
@property (nonatomic, assign) BOOL showsOverlayImagesModally
Discussion
Default: YES
Declared In
RKAbstractTableController.h
Instance Methods
cellForObjectAtIndexPath:
Returns the UITableViewCell created by applying the specified mapping operation to the object identified by indexPath.
- (UITableViewCell *)cellForObjectAtIndexPath:(NSIndexPath *)indexPath
Parameters
- indexPath
The indexPath in the tableView for which a cell is needed.
Declared In
RKAbstractTableController.h
didFinishLoad
Must be invoked when the table controller has finished loading.
- (void)didFinishLoad
Discussion
Responsible for finalizing loading, empty, and loaded states and cleaning up the table overlay view.
Declared In
RKAbstractTableController_Internals.h
indexForSection:
Returns the index of the specified section.
- (NSUInteger)indexForSection:(RKTableSection *)section
Parameters
- section
Must be a valid non nil RKTableViewSection.
Return Value
If section is not found, method returns NSNotFound.
Declared In
RKAbstractTableController.h
indexPathForObject:
Return the index path of the object within the table
- (NSIndexPath *)indexPathForObject:(id)object
Declared In
RKAbstractTableController.h