Inherits from NSObject
Conforms to UITableViewDataSource
UITableViewDelegate
Declared in RETableViewManager.h
RETableViewManager.m

Overview

RETableViewManager allows to manage the content of any UITableView with ease, both forms and lists. RETableViewManager is built on top of reusable cells technique and provides APIs for mapping any object class to any custom cell subclass.

The general idea is to allow developers to use their own UITableView and UITableViewController instances (and even subclasses), providing a layer that synchronizes data with the cell appereance. It fully implements UITableViewDelegate and UITableViewDataSource protocols so you don’t have to.

Tasks

Managing Table View and Sections

Creating and Initializing a RETableViewManager

Managing the Delegate

  •   delegate

    The object that acts as the delegate of the receiving table view.

    property

Managing Custom Cells

Setting Style

Adding sections

Removing Sections

Replacing Sections

Rearranging Sections

Properties

delegate

The object that acts as the delegate of the receiving table view.

@property (assign, readwrite, nonatomic) id<RETableViewManagerDelegate,UITableViewDelegate> delegate

Discussion

The object that acts as the delegate of the receiving table view.

Declared In

RETableViewManager.h

registeredClasses

The array of pairs of items / cell classes.

@property (strong, readwrite, nonatomic) NSMutableDictionary *registeredClasses

Discussion

The array of pairs of items / cell classes.

Declared In

RETableViewManager.h

sections

The array of sections. See RETableViewSection reference for details.

@property (strong, readwrite, nonatomic) NSMutableArray *sections

Discussion

The array of sections. See RETableViewSection reference for details.

Declared In

RETableViewManager.h

style

The object that provides styling for UITableView. See RETableViewCellStyle reference for details.

@property (strong, readonly, nonatomic) RETableViewCellStyle *style

Discussion

The object that provides styling for UITableView. See RETableViewCellStyle reference for details.

Declared In

RETableViewManager.h

tableView

The UITableView that needs to be managed using this RETableViewManager.

@property (weak, readwrite, nonatomic) UITableView *tableView

Discussion

The UITableView that needs to be managed using this RETableViewManager.

Declared In

RETableViewManager.h

Instance Methods

addSection:

Inserts a given section at the end of the table view.

- (void)addSection:(RETableViewSection *)section

Parameters

section

The section to add to the end of the table view. This value must not be nil.

Discussion

Inserts a given section at the end of the table view.

Declared In

RETableViewManager.h

addSectionsFromArray:

Adds the sections contained in another given sections array to the end of the table view.

- (void)addSectionsFromArray:(NSArray *)array

Parameters

array

An array of sections to add to the end of the table view.

Discussion

Adds the sections contained in another given sections array to the end of the table view.

Declared In

RETableViewManager.h

classForCellAtIndexPath:

Returns cell class at specified index path.

- (Class)classForCellAtIndexPath:(NSIndexPath *)indexPath

Parameters

indexPath

The index path of cell.

Discussion

Returns cell class at specified index path.

Declared In

RETableViewManager.h

exchangeSectionAtIndex:withSectionAtIndex:

Exchanges the sections in the table view at given indices.

- (void)exchangeSectionAtIndex:(NSUInteger)idx1 withSectionAtIndex:(NSUInteger)idx2

Parameters

idx1

The index of the section with which to replace the section at index idx2.

idx2

The index of the section with which to replace the section at index idx1.

Discussion

Exchanges the sections in the table view at given indices.

Declared In

RETableViewManager.h

initWithTableView:

Initialize a table view manager object for a specific UITableView.

- (id)initWithTableView:(UITableView *)tableView

Parameters

tableView

The UITableView that needs to be managed.

Return Value

The pointer to the instance, or nil if initialization failed.

Discussion

Initialize a table view manager object for a specific UITableView.

Declared In

RETableViewManager.h

initWithTableView:delegate:

Initialize a table view manager object for a specific UITableView and specify the delegate object.

- (id)initWithTableView:(UITableView *)tableView delegate:(id<RETableViewManagerDelegate,UITableViewDelegate>)delegate

Parameters

tableView

The UITableView that needs to be managed.

delegate

The delegate (RETableViewManagerDelegate) object for the table view manager.

Return Value

The pointer to the instance, or nil if initialization failed.

Discussion

Initialize a table view manager object for a specific UITableView and specify the delegate object.

Declared In

RETableViewManager.h

insertSection:atIndex:

Inserts a given section into the table view at a given index.

- (void)insertSection:(RETableViewSection *)section atIndex:(NSUInteger)index

Parameters

section

The section to add to the table view. This value must not be nil.

index

The index in the sections array at which to insert section. This value must not be greater than the count of sections in the table view.

Discussion

Inserts a given section into the table view at a given index.

Declared In

RETableViewManager.h

insertSections:atIndexes:

Inserts the sections in the provided array into the table view at the specified indexes.

- (void)insertSections:(NSArray *)sections atIndexes:(NSIndexSet *)indexes

Parameters

sections

An array of sections to insert into the table view.

indexes

The indexes at which the sections in sections should be inserted. The count of locations in indexes must equal the count of sections.

Discussion

Inserts the sections in the provided array into the table view at the specified indexes.

Declared In

RETableViewManager.h

objectAtKeyedSubscript:

Returns cell class at the keyed subscript.

- (id)objectAtKeyedSubscript:(id<NSCopying>)key

Parameters

key

The keyed subscript.

Return Value

The cell class the keyed subscript.

Discussion

Returns cell class at the keyed subscript.

Declared In

RETableViewManager.h

registerClass:forCellWithReuseIdentifier:

For each custom item class that the manager will use, register a cell class.

- (void)registerClass:(NSString *)objectClass forCellWithReuseIdentifier:(NSString *)identifier

Parameters

objectClass

The object class to be associated with a cell class.

identifier

The cell class identifier.

Discussion

For each custom item class that the manager will use, register a cell class.

Declared In

RETableViewManager.h

removeAllSections

Empties the table view of all its sections.

- (void)removeAllSections

Discussion

Empties the table view of all its sections.

Declared In

RETableViewManager.h

removeLastSection

Removes the section with the highest-valued index in the table view.

- (void)removeLastSection

Discussion

Removes the section with the highest-valued index in the table view.

Declared In

RETableViewManager.h

removeSection:

Removes all occurrences in the table view of a given section.

- (void)removeSection:(RETableViewSection *)section

Parameters

section

The section to remove from the table view.

Discussion

Removes all occurrences in the table view of a given section.

Declared In

RETableViewManager.h

removeSection:inRange:

Removes all occurrences within a specified range in the table view of a given section.

- (void)removeSection:(RETableViewSection *)section inRange:(NSRange)range

Parameters

section

The section to remove from the table view.

range

The range from which to remove section.

Discussion

Removes all occurrences within a specified range in the table view of a given section.

Declared In

RETableViewManager.h

removeSectionAtIndex:

Removes the section at index.

- (void)removeSectionAtIndex:(NSUInteger)index

Parameters

index

The index from which to remove the section in the table view. The value must not exceed the bounds of the table view sections.

Discussion

Removes the section at index.

Declared In

RETableViewManager.h

removeSectionIdenticalTo:

Removes all occurrences of a given section in the sections array.

- (void)removeSectionIdenticalTo:(RETableViewSection *)section

Parameters

section

The section to remove from the sections array.

Discussion

Removes all occurrences of a given section in the sections array.

Declared In

RETableViewManager.h

removeSectionIdenticalTo:inRange:

Removes all occurrences of section within the specified range in the table view.

- (void)removeSectionIdenticalTo:(RETableViewSection *)section inRange:(NSRange)range

Parameters

section

The section to remove from the table view within range.

range

The range in the table view from which to remove section.

Discussion

Removes all occurrences of section within the specified range in the table view.

Declared In

RETableViewManager.h

removeSectionsAtIndexes:

Removes the sections at the specified indexes from the table view.

- (void)removeSectionsAtIndexes:(NSIndexSet *)indexes

Parameters

indexes

The indexes of the sections to remove from the table view. The locations specified by indexes must lie within the bounds of the table view sections.

Discussion

Removes the sections at the specified indexes from the table view.

Declared In

RETableViewManager.h

removeSectionsInArray:

Removes from the table view the sections in another given array.

- (void)removeSectionsInArray:(NSArray *)otherArray

Parameters

otherArray

An array containing the sections to be removed from the table view.

Discussion

Removes from the table view the sections in another given array.

Declared In

RETableViewManager.h

removeSectionsInRange:

Removes from the table view each of the sections within a given range.

- (void)removeSectionsInRange:(NSRange)range

Parameters

range

The range of the sections to remove from the table view.

Discussion

Removes from the table view each of the sections within a given range.

Declared In

RETableViewManager.h

replaceSectionAtIndex:withSection:

Replaces the section at index with section.

- (void)replaceSectionAtIndex:(NSUInteger)index withSection:(RETableViewSection *)section

Parameters

index

The index of the section to be replaced. This value must not exceed the bounds of the table view sections.

section

The section with which to replace the section at index index in the sections array. This value must not be nil.

Discussion

Replaces the section at index with section.

Declared In

RETableViewManager.h

replaceSectionsAtIndexes:withSections:

Replaces the sections in the table view at specified locations specified with the sections from a given array.

- (void)replaceSectionsAtIndexes:(NSIndexSet *)indexes withSections:(NSArray *)sections

Parameters

indexes

The indexes of the sections to be replaced.

sections

The sections with which to replace the sections in the table view at the indexes specified by indexes. The count of locations in indexes must equal the count of sections.

Discussion

Replaces the sections in the table view at specified locations specified with the sections from a given array.

Declared In

RETableViewManager.h

replaceSectionsInRange:withSectionsFromArray:

Replaces the sections in the table view specified by a given range with all of the sections from a given array.

- (void)replaceSectionsInRange:(NSRange)range withSectionsFromArray:(NSArray *)otherArray

Parameters

range

The range of sections to replace in (or remove from) the table view.

otherArray

The array of sections from which to select replacements for the sections in range.

Discussion

Replaces the sections in the table view specified by a given range with all of the sections from a given array.

Declared In

RETableViewManager.h

replaceSectionsInRange:withSectionsFromArray:range:

Replaces the sections in the table view by one given range with the sections in another array specified by another range.

- (void)replaceSectionsInRange:(NSRange)range withSectionsFromArray:(NSArray *)otherArray range:(NSRange)otherRange

Parameters

range

The range of sections to replace in (or remove from) the table view.

otherArray

The array of sections from which to select replacements for the sections in range.

otherRange

The range of sections to select from otherArray as replacements for the sections in range.

Discussion

Replaces the sections in the table view by one given range with the sections in another array specified by another range.

Declared In

RETableViewManager.h

replaceSectionsWithSectionsFromArray:

Replaces the sections in the table view with all of the sections from a given array.

- (void)replaceSectionsWithSectionsFromArray:(NSArray *)otherArray

Parameters

otherArray

The array of sections from which to select replacements for the sections.

Discussion

Replaces the sections in the table view with all of the sections from a given array.

Declared In

RETableViewManager.h

setObject:forKeyedSubscript:

Sets a cell class for the keyed subscript.

- (void)setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key

Parameters

obj

The cell class to set for the keyed subscript.

key

The keyed subscript.

Discussion

Sets a cell class for the keyed subscript.

Declared In

RETableViewManager.h

sortSectionsUsingFunction:context:

Sorts the sections in ascending order as defined by the comparison function compare.

- (void)sortSectionsUsingFunction:(NSInteger ( *) ( id , id , void *))compare context:(void *)context

Parameters

compare

The comparison function to use to compare two sections at a time.

context

The context argument to pass to the compare function.

Discussion

Sorts the sections in ascending order as defined by the comparison function compare.

Declared In

RETableViewManager.h

sortSectionsUsingSelector:

Sorts the sections in ascending order, as determined by the comparison method specified by a given selector.

- (void)sortSectionsUsingSelector:(SEL)comparator

Parameters

comparator

A selector that specifies the comparison method to use to compare sections in the table view.

Discussion

Sorts the sections in ascending order, as determined by the comparison method specified by a given selector.

Declared In

RETableViewManager.h