Reputation: 8340
There is a table view with three sections. The last section may contain many items. I need to show a button on the navigation bar as soon as the table view is showing only the last section (e.g. user scrolled the cells up so that the first and second view became invisible).
So basically how to detect that the table view is now showing only the last section and cells from the first two sections are no longer visible?
Upvotes: 0
Views: 946
Reputation: 3727
UITableView class has to methods:
- (NSArray *)indexPathsForVisibleRows; - (NSArray *)indexPathsForRowsInRect:(CGRect)rect;
Have you tried them? Do they help?
Upvotes: 2
Reputation: 1356
You can use the tableview delegate to check which section cells are being created by checking it's indexpath.
Or you can use the below function to get cells that are visible and then check for to which section it belongs to.
Upvotes: 0
Reputation: 5787
You could try to iterate over UITableView's indexPathsForVisibleRows to see if the cells in the relevant section are contained in the array.
Upvotes: 0