Add table view index to the sample app (#3513)

This commit is contained in:
Chuan Ren authored and GitHub committed 2019-08-06 14:35:48 -07:00
1 parent 2c86f3a4d7
commit c67c32afda
1 file changed
+12
@@ -54,6 +54,18 @@ static NSString *const kValueCellReuseIdentitfier = @"reuseValueIdentifier";
return _contents.sections[section].title;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
return index;
}
- (NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSMutableArray<NSString *> *sectionTitles = [NSMutableArray array];
for (StaticContentTableViewSection *section in _contents.sections) {
[sectionTitles addObject:[section.title substringToIndex:3]];
}
return sectionTitles;
}
#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {