What's the UITableView index magnifying glass character?

前端 未结 11 1830
醉话见心
醉话见心 2020-12-12 10:09

In Apple\'s iPhone apps (like Contacts), they have a nice magnifying glass icon at the top of the table view index. Since the table view index API is character-based, I assu

11条回答
  •  被撕碎了的回忆
    2020-12-12 11:06

    In tableView:sectionForSectionIndexTitle:AtIndex: explicitly scroll to the top and return NSNotFound:

    - (NSInteger) tableView:(UITableView *)tableView
    sectionForSectionIndexTitle:(NSString *)title
                    atIndex:(NSInteger)index {
        if (index == 0) {
            [tableView setContentOffset:CGPointZero animated:NO];
            return NSNotFound;
        }
        return index;
    }
    

提交回复
热议问题