ASTableView Class Reference
| Inherits from | UITableView |
|---|---|
| Declared in | ASTableView.h |
Overview
Asynchronous UITableView with Intelligent Preloading capabilities.
ASTableNode is recommended over ASTableView. This class is provided for adoption convenience.
ASTableView is a true subclass of UITableView, meaning it is pointer-compatible with code that currently uses UITableView
The main difference is that asyncDataSource expects -nodeForRowAtIndexPath, an ASCellNode, and the heightForRowAtIndexPath: method is eliminated (as are the performance problems caused by it). This is made possible because ASCellNodes can calculate their own size, and preload ahead of time.
– initWithFrame:style:
Initializer.
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)styleParameters
frame |
A rectangle specifying the initial location and size of the table view in its superview’s coordinates. The frame of the table view changes as table cells are added and deleted. |
|---|---|
style |
A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. |
Declared In
ASTableView.h
– tuningParametersForRangeType:
Tuning parameters for a range type in full mode.
- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeTypeParameters
rangeType |
The range type to get the tuning parameters for. |
|---|
Return Value
A tuning parameter value for the given range type in full mode.
Declared In
ASTableView.h
– setTuningParameters:forRangeType:
Set the tuning parameters for a range type in full mode.
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeTypeParameters
tuningParameters |
The tuning parameters to store for a range type. |
|---|---|
rangeType |
The range type to set the tuning parameters for. |
Declared In
ASTableView.h
– tuningParametersForRangeMode:rangeType:
Tuning parameters for a range type in the specified mode.
- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeTypeParameters
rangeMode |
The range mode to get the running parameters for. |
|---|---|
rangeType |
The range type to get the tuning parameters for. |
Return Value
A tuning parameter value for the given range type in the given mode.
Declared In
ASTableView.h
– setTuningParameters:forRangeMode:rangeType:
Set the tuning parameters for a range type in the specified mode.
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeTypeParameters
tuningParameters |
The tuning parameters to store for a range type. |
|---|---|
rangeMode |
The range mode to set the running parameters for. |
rangeType |
The range type to set the tuning parameters for. |
Declared In
ASTableView.h
leadingScreensForBatching
The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called.
@property (nonatomic, assign) CGFloat leadingScreensForBatchingDiscussion
Defaults to two screenfuls.
Declared In
ASTableView.h
– reloadDataWithCompletion:
Reload everything from scratch, destroying the working range and all cached nodes.
- (void)reloadDataWithCompletion:(void ( ^ _Nullable ) ( ))completionParameters
completion |
block to run on completion of asynchronous loading or nil. If supplied, the block is run on the main thread. |
|---|
Discussion
Warning: This method is substantially more expensive than UITableView’s version.
Declared In
ASTableView.h
– reloadData
Reload everything from scratch, destroying the working range and all cached nodes.
- (void)reloadDataDiscussion
Warning: This method is substantially more expensive than UITableView’s version.
Declared In
ASTableView.h
– reloadDataImmediately
Reload everything from scratch entirely on the main thread, destroying the working range and all cached nodes.
- (void)reloadDataImmediatelyDiscussion
Warning: This method is substantially more expensive than UITableView’s version and will block the main thread while all the cells load.
Declared In
ASTableView.h
– beginUpdates
begins a batch of insert, delete reload and move operations. This method must be called from the main thread.
- (void)beginUpdatesDeclared In
ASTableView.h
– endUpdates
Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view, with animation enabled and no completion block. You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating the operations simultaneously. This method is must be called from the main thread. It’s important to remember that the ASTableView will be processing the updates asynchronously after this call is completed.
- (void)endUpdatesDeclared In
ASTableView.h
– endUpdatesAnimated:completion:
Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating the operations simultaneously. This method is must be called from the main thread. It’s important to remember that the ASTableView will be processing the updates asynchronously after this call and are not guaranteed to be reflected in the ASTableView until the completion block is executed.
- (void)endUpdatesAnimated:(BOOL)animated completion:(void ( ^ _Nullable ) ( BOOL completed ))completionParameters
animated |
NO to disable all animations. |
|---|---|
completion |
A completion handler block to execute when all of the operations are finished. This block takes a single Boolean parameter that contains the value YES if all of the related animations completed successfully or NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. |
Declared In
ASTableView.h
– waitUntilAllUpdatesAreCommitted
Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread.
- (void)waitUntilAllUpdatesAreCommittedDeclared In
ASTableView.h
– insertSections:withRowAnimation:
Inserts one or more sections, with an option to animate the insertion.
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animationParameters
sections |
An index set that specifies the sections to insert. |
|---|---|
animation |
A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– deleteSections:withRowAnimation:
Deletes one or more sections, with an option to animate the deletion.
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animationParameters
sections |
An index set that specifies the sections to delete. |
|---|---|
animation |
A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– reloadSections:withRowAnimation:
Reloads the specified sections using a given animation effect.
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animationParameters
sections |
An index set that specifies the sections to reload. |
|---|---|
animation |
A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– moveSection:toSection:
Moves a section to a new location.
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSectionParameters
section |
The index of the section to move. |
|---|---|
newSection |
The index that is the destination of the move for the section. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– insertRowsAtIndexPaths:withRowAnimation:
Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion.
- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animationParameters
indexPaths |
An array of NSIndexPath objects, each representing a row index and section index that together identify a row. |
|---|---|
animation |
A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– deleteRowsAtIndexPaths:withRowAnimation:
Deletes the rows specified by an array of index paths, with an option to animate the deletion.
- (void)deleteRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animationParameters
indexPaths |
An array of NSIndexPath objects identifying the rows to delete. |
|---|---|
animation |
A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– reloadRowsAtIndexPaths:withRowAnimation:
Reloads the specified rows using a given animation effect.
- (void)reloadRowsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animationParameters
indexPaths |
An array of NSIndexPath objects identifying the rows to reload. |
|---|---|
animation |
A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– moveRowAtIndexPath:toIndexPath:
Moves the row at a specified location to a destination location.
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPathParameters
indexPath |
The index path identifying the row to move. |
|---|---|
newIndexPath |
The index path that is the destination of the move for the row. |
Discussion
This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes before this method is called.
Declared In
ASTableView.h
– nodeForRowAtIndexPath:
Similar to -cellForRowAtIndexPath:.
- (ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPathParameters
indexPath |
The index path of the requested node. |
|---|
Return Value
a node for display at this indexpath.
Declared In
ASTableView.h
– indexPathForNode:
Similar to -indexPathForCell:.
- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNodeParameters
cellNode |
a cellNode part of the table view |
|---|
Return Value
an indexPath for this cellNode
Declared In
ASTableView.h
– visibleNodes
Similar to -visibleCells.
- (NSArray<ASCellNode*> *)visibleNodesReturn Value
an array containing the cell nodes being displayed on screen.
Declared In
ASTableView.h
automaticallyAdjustsContentOffset
YES to automatically adjust the contentOffset when cells are inserted or deleted “before” visible cells, maintaining the users' visible scroll position. Currently this feature tracks insertions, moves and deletions of cells, but section edits are ignored.
@property (nonatomic) BOOL automaticallyAdjustsContentOffsetDiscussion
default is NO.
Declared In
ASTableView.h
– clearContents
Triggers all loaded ASCellNodes to destroy displayed contents (freeing a lot of memory).
- (void)clearContentsDiscussion
This method should only be called by ASTableNode. To be removed in a later release.
Declared In
ASTableView.h
– clearFetchedData
Triggers all loaded ASCellNodes to purge any data fetched from the network or disk (freeing memory).
- (void)clearFetchedDataDiscussion
This method should only be called by ASTableNode. To be removed in a later release.
Declared In
ASTableView.h