static NSInteger currentTopVisibleSection = -1;
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSIndexPath *topCellPath = [[tableView indexPathsForVisibleRows] objectAtIndex:0];
if (currentTopVisibleSection != topCellPath.section) {
currentTopVisibleSection = topCellPath.section;
NSLog(@"current section on top is %d", currentTopVisibleSection);
}
NSString *header = [NSString stringWithFormat:@"Section %d", section];
return header;
}
Objective C: UITableView: Detect which section header on top
Ярлыки:
iOS,
objective C,
ObjectiveC categories,
section header,
UITableView
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment