TKListView Class Reference
Inherits from | UIView |
Conforms to | UICollectionViewDataSource UICollectionViewDelegate |
Declared in | TKListView.h |
Overview
TKListView provides means for displaying lists of data. The items of the list can be arranged in a columns layout or wrap layout. It provides UI virtualization, pull-to-refresh, load-on-demand, cells swipe, cell reorder, single/multiple selection, grouping.
Tasks
-
delegate
property -
dataSource
property -
layout
property -
allowsMultipleSelection
property -
allowsCellReorder
property -
allowsCellSwipe
property -
autoRestrictSwipeDirection
property -
allowsPullToRefresh
property -
deselectOnSecondTap
property -
reorderMode
property -
cellSwipeLimits
property -
cellSwipeTreshold
property -
cellSwipeAnimationDuration
property -
autoScrollTreshold
property -
pullToRefreshTreshold
property -
loadOnDemandMode
property -
loadOnDemandBufferSize
property -
contentInset
property -
contentOffset
property -
collectionView
property -
scrollDirection
property -
selectionBehavior
property -
pullToRefreshView
property -
loadOnDemandView
property -
backgroundView
property -
indexPathsForSelectedItems
property -
numberOfSections
property -
visibleCells
property -
indexPathsForVisibleItems
property -
– reloadData
-
– endSwipe:
-
– clearSelectedItems
-
– selectItemAtIndexPath:animated:scrollPosition:
-
– deselectItemAtIndexPath:animated:
-
– dequeueReusableCellWithReuseIdentifier:forIndexPath:
-
– dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:
-
– dequeueLoadOnDemandCellForIndexPath:
-
– registerLoadOnDemandCell:
-
– registerClass:forCellWithReuseIdentifier:
-
– registerClass:forSupplementaryViewOfKind:withReuseIdentifier:
-
– registerNib:forCellReuseIdentifier:
-
– registerNib:forSupplementaryViewOfKind:withReuseIdentifier:
-
– cellForItemAtIndexPath:
-
– insertItemsAtIndexPaths:
-
– moveItemAtIndexPath:toIndexPath:
-
– deleteItemsAtIndexPaths:
-
– reloadItemsAtIndexPaths:
-
– performBatchUpdates:completion:
-
– numberOfItemsInSection:
-
– indexPathForItemAtPoint:
-
– indexPathForCell:
-
– scrollToItemAtIndexPath:atScrollPosition:animated:
-
– setContentOffset:animated:
-
– didLoadDataOnDemand
Properties
allowsCellReorder
Indicates whether user is able to reorder cells.
@property (nonatomic) BOOL allowsCellReorder
Declared In
TKListView.h
allowsCellSwipe
Indicates whether the end-user is able to swipe cells.
@property (nonatomic) BOOL allowsCellSwipe
Declared In
TKListView.h
allowsMultipleSelection
Indicates whether user is able to select multiple items.
@property (nonatomic) BOOL allowsMultipleSelection
Declared In
TKListView.h
allowsPullToRefresh
Indicates whether user is able to perform the pull-to-refresh gesture.
@property (nonatomic) BOOL allowsPullToRefresh
Declared In
TKListView.h
autoRestrictSwipeDirection
Restricts the swipe direction based on the current scroll orientation.
@property (nonatomic) BOOL autoRestrictSwipeDirection
Declared In
TKListView.h
autoScrollTreshold
The distance from the edge where autoscroll commences while dragging/reordering a cell.
@property (nonatomic) CGFloat autoScrollTreshold
Declared In
TKListView.h
backgroundView
A view that will be automatically resized to track the size of the collection view and placed behind all cells and supplementary views.
@property (nonatomic, retain) UIView *backgroundView
Declared In
TKListView.h
cellSwipeAnimationDuration
The cell swipe animation duration.
@property (nonatomic) CGFloat cellSwipeAnimationDuration
Declared In
TKListView.h
cellSwipeLimits
The maximum distance a cell can be swiped by the end-user.
@property (nonatomic) UIEdgeInsets cellSwipeLimits
Declared In
TKListView.h
cellSwipeTreshold
The cell swipe treshold - the distance defining whether the cell will revert to original position or animate to the swipe limits if the end-user does not finish the swipe gesture.
@property (nonatomic) CGFloat cellSwipeTreshold
Declared In
TKListView.h
collectionView
The collection view used by the component.
@property (nonatomic, strong) TKCollectionView *collectionView
Declared In
TKListView.h
contentInset
The content insets relative to its view size.
@property (nonatomic) UIEdgeInsets contentInset
Declared In
TKListView.h
contentOffset
The content offset.
@property (nonatomic) CGPoint contentOffset
Declared In
TKListView.h
dataSource
A datasource delegate used to provide data for the cells, headers and footers.
@property (nonatomic, weak, nullable) id<TKListViewDataSource> dataSource
Declared In
TKListView.h
delegate
A delegate used to manage the selection of items in TKListView, perform actions on those items and respond to interaction with those items.
@property (nonatomic, weak, nullable) id<TKListViewDelegate> delegate
Declared In
TKListView.h
deselectOnSecondTap
Defines whether to deselect an already selected item with a second tap. This property value is respected only when using single selection mode.
@property (nonatomic) BOOL deselectOnSecondTap
Declared In
TKListView.h
indexPathsForSelectedItems
Returns an array with the index paths of the selected items.
@property (nonatomic, strong, readonly, nullable) NSArray *indexPathsForSelectedItems
Declared In
TKListView.h
indexPathsForVisibleItems
Returns the index paths for the currently visible cells.
@property (nonatomic, strong, readonly, nonnull) NSArray<NSIndexPath*> *indexPathsForVisibleItems
Declared In
TKListView.h
layout
The layout object used to arrange cells.
@property (nonatomic, strong) UICollectionViewLayout *layout
Declared In
TKListView.h
loadOnDemandBufferSize
Defines the number of cells from the bottom of TKListView up at which to start requesting load-on-demand data.
@property (nonatomic) NSInteger loadOnDemandBufferSize
Declared In
TKListView.h
loadOnDemandMode
Defines the load on demand mode.
@property (nonatomic) TKListViewLoadOnDemandMode loadOnDemandMode
Declared In
TKListView.h
loadOnDemandView
The UIView containing the activity indicator while TKListView is loading data on demand and has scrolled to the end of the content size.
@property (nonatomic, strong) TKListViewLoadOnDemandView *loadOnDemandView
Declared In
TKListView.h
numberOfSections
Returns the number of sections.
@property (nonatomic, readonly) NSInteger numberOfSections
Declared In
TKListView.h
pullToRefreshTreshold
The pull distance at which pull-to-refresh activates.
@property (nonatomic) CGFloat pullToRefreshTreshold
Declared In
TKListView.h
pullToRefreshView
The UIView containing the activity indicator while TKListView is refreshing data after the pull-to-refresh gesture.
@property (nonatomic, strong) TKListViewPullToRefreshView *pullToRefreshView
Declared In
TKListView.h
reorderMode
Defines the reorder mode.
@property (nonatomic) TKListViewReorderMode reorderMode
Declared In
TKListView.h
scrollDirection
Defines the scroll direction. Applicable if the current layout supports it.
@property (nonatomic) TKListViewScrollDirection scrollDirection
Declared In
TKListView.h
Instance Methods
cellForItemAtIndexPath:
Returns the visible cell object at the specified index path.
- (TKListViewCell *__nullable)cellForItemAtIndexPath:(NSIndexPath *__nonnull)indexPath
Parameters
- indexPath
The index path for the cell.
Declared In
TKListView.h
clearSelectedItems
Deselects all selected items.
- (void)clearSelectedItems
Declared In
TKListView.h
deleteItemsAtIndexPaths:
Deletes the items at the specified index paths.
- (void)deleteItemsAtIndexPaths:(NSArray *__nonnull)indexPaths
Parameters
- indexPaths
The index paths of the deleted items.
Declared In
TKListView.h
dequeueLoadOnDemandCellForIndexPath:
Returns a TKListViewCell that should be used as load on demand cell when loadOnDemandMode is set to manual.
- (TKListViewCell *__nullable)dequeueLoadOnDemandCellForIndexPath:(NSIndexPath *__nonnull)indexPath
Parameters
- indexPath
The index path.
Declared In
TKListView.h
dequeueReusableCellWithReuseIdentifier:forIndexPath:
Returns a TKListVIewCell to be provided in the listView:cellForItemAtIndexPath:ndexPath delegate method.
- (id __nullable)dequeueReusableCellWithReuseIdentifier:(NSString *__nonnull)identifier forIndexPath:(NSIndexPath *__nonnull)indexPath
Parameters
- identifier
A string identifier of the cell type.
- indexPath
The index path of the item we need a cell for.
Declared In
TKListView.h
dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:
Returns a header or footer view to be provided in the listView:viewForSupplementaryElementOfKind:atIndexPath:
- (id __nullable)dequeueReusableSupplementaryViewOfKind:(NSString *__nonnull)elementKind withReuseIdentifier:(NSString *__nonnull)identifier forIndexPath:(NSIndexPath *__nonnull)indexPath
Parameters
- elementKind
The element kind - header or footer.
- identifier
A string identifier of the view type.
- indexPath
The index path of the supplementary view.
Declared In
TKListView.h
deselectItemAtIndexPath:animated:
Deselects an item at the given index path.
- (void)deselectItemAtIndexPath:(NSIndexPath *__nonnull)indexPath animated:(BOOL)animated
Parameters
- indexPath
The index path of the item to deselect.
- animated
Determines whether to animate the selection.
Declared In
TKListView.h
didLoadDataOnDemand
Notifies the list view that a new data requested on demand is ready to be shown.
- (void)didLoadDataOnDemand
Declared In
TKListView.h
endSwipe:
Restores the swiped cell to its initial state.
- (void)endSwipe:(BOOL)animated
Parameters
- animated
Determines whether to animate the cell.
Declared In
TKListView.h
indexPathForCell:
Returns the index path for specific cell.
- (NSIndexPath *__nonnull)indexPathForCell:(UICollectionViewCell *__nullable)cell
Parameters
- cell
The cell.
Declared In
TKListView.h
indexPathForItemAtPoint:
Returns the index path for the item at the specified location.
- (NSIndexPath *__nullable)indexPathForItemAtPoint:(CGPoint)point
Parameters
- point
The point where the item is located.
Declared In
TKListView.h
insertItemsAtIndexPaths:
Inserts new items at the specified index paths.
- (void)insertItemsAtIndexPaths:(NSArray *__nonnull)indexPaths
Parameters
- indexPaths
The index paths of the newly inserted items.
Declared In
TKListView.h
moveItemAtIndexPath:toIndexPath:
Moves an item from one location to another in the list view.
- (void)moveItemAtIndexPath:(NSIndexPath *__nonnull)indexPath toIndexPath:(NSIndexPath *__nonnull)newIndexPath
Parameters
- indexPath
The old index path.
- newIndexPath
The new index path.
Declared In
TKListView.h
numberOfItemsInSection:
Returns the number of items conatined in specific section.
- (NSInteger)numberOfItemsInSection:(NSInteger)section
Parameters
- section
The index of the section.
Declared In
TKListView.h
performBatchUpdates:completion:
Allows multiple insert/delete/reload/move calls to be animated.
- (void)performBatchUpdates:(void ( ^ __nullable ) ( void ))updates completion:(void ( ^ __nullable ) ( BOOL finished ))completion
Parameters
- updates
The updates to apply.
- completion
Will be executed upon completion.
Declared In
TKListView.h
registerClass:forCellWithReuseIdentifier:
Registers a class to be used to represent cells in listview.
- (void)registerClass:(Class __nonnull)cellClass forCellWithReuseIdentifier:(NSString *__nonnull)identifier
Parameters
- cellClass
The class of the UIView to represent a cell.
- identifier
A string identifier of the cell type.
Declared In
TKListView.h
registerClass:forSupplementaryViewOfKind:withReuseIdentifier:
Registers a class to be used to represent headers and footers.
- (void)registerClass:(Class __nonnull)viewClass forSupplementaryViewOfKind:(NSString *__nonnull)elementKind withReuseIdentifier:(NSString *__nonnull)identifier
Parameters
- viewClass
The class of the UIView to represent a header or footer.
- elementKind
The element kind - header or footer.
- identifier
A string identifier of the supplementary view type.
Declared In
TKListView.h
registerLoadOnDemandCell:
Registers a class to be used to represent load on demand cell in listview.
- (void)registerLoadOnDemandCell:(Class __nonnull)cellClass
Parameters
- cellClass
The cell class.
Declared In
TKListView.h
registerNib:forCellReuseIdentifier:
Registers a nib file to be used to represent cells in listview.
- (void)registerNib:(UINib *__nullable)nib forCellReuseIdentifier:(NSString *__nonnull)identifier
Parameters
- nib
The nib instance to represent a cell.
- identifier
A string identifier of the cell type.
Declared In
TKListView.h
registerNib:forSupplementaryViewOfKind:withReuseIdentifier:
Registers a class to be used to represent headers and footers.
- (void)registerNib:(UINib *__nullable)nib forSupplementaryViewOfKind:(NSString *__nonnull)elementKind withReuseIdentifier:(NSString *__nonnull)identifier
Parameters
- nib
The nib instance to represent a header or footer.
- elementKind
The element kind - header or footer.
- identifier
A string identifier of the supplementary view type.
Declared In
TKListView.h
reloadItemsAtIndexPaths:
Reloads the items at the specified index paths.
- (void)reloadItemsAtIndexPaths:(NSArray *__nonnull)indexPaths
Parameters
- indexPaths
The index paths of items to reload.
Declared In
TKListView.h
scrollToItemAtIndexPath:atScrollPosition:animated:
Scrolls to specific item.
- (void)scrollToItemAtIndexPath:(NSIndexPath *__nonnull)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated
Parameters
- indexPath
The index path for the item.
- scrollPosition
The scroll position.
- animated
Determines whether to animate the scrolling.
Declared In
TKListView.h
selectItemAtIndexPath:animated:scrollPosition:
Selects an item at the given index path.
- (void)selectItemAtIndexPath:(NSIndexPath *__nonnull)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition
Parameters
- indexPath
The index path of the item to select.
- animated
Determines whether to animate the selection.
- scrollPosition
The scroll position.
Declared In
TKListView.h
setContentOffset:animated:
Sets the scroll offset with the given amount in a horizontal and vertical direction by either using animation or not.
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated
Parameters
- contentOffset
a CGPoint instance representing the horizontal and vertical amount of scroll offset to be applied.
- animated
a bool value determining whether animation is to be used or not.
Declared In
TKListView.h