how to know indexpath of UITableView.visibleCells? how to know indexpath of UITableView.visibleCells? ios ios

how to know indexpath of UITableView.visibleCells?


Here is method in UITableView class:

objective-c

- (NSArray *)indexPathsForVisibleRows

Swift

public var indexPathsForVisibleRows: [NSIndexPath]? { get }


UITableView has a method to find the indexPath of a cell:

- (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell

Just iterate over your visible cells array and pass each cell to get the index path.

for (UITableViewCell *cell in arrayOfVisibleTVC) {  NSIndexPath *path = [[BNUtilitiesQuick ListController].tableViewA indexPathForCell:cell];  NSLog(@"%@", path);}


matomo