From c67c32afda3d686c9eb36b0af37a31ef4e618b08 Mon Sep 17 00:00:00 2001 From: Chuan Ren Date: Tue, 6 Aug 2019 14:35:48 -0700 Subject: [PATCH] Add table view index to the sample app (#3513) --- Example/Auth/Sample/StaticContentTableViewManager.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Example/Auth/Sample/StaticContentTableViewManager.m b/Example/Auth/Sample/StaticContentTableViewManager.m index 54dd11a39d..2b94778ca8 100644 --- a/Example/Auth/Sample/StaticContentTableViewManager.m +++ b/Example/Auth/Sample/StaticContentTableViewManager.m @@ -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 *)sectionIndexTitlesForTableView:(UITableView *)tableView { + NSMutableArray *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 {