我想用放大镜图标创建索引的UITableView。 我意识到UITableViewIndexSearch在索引中创建图标,但我不知道用什么来替换它。任何帮助或建议将不胜感激。没有放大镜的UITableView索引
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [[self.fetchedResultsController sections] count];}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
return index;}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
// Return the array of section index titles
NSArray *searchArray = [NSArray arrayWithObject:UITableViewIndexSearch];
return [searchArray arrayByAddingObjectsFromArray:self.fetchedResultsController.sectionIndexTitles];}
- (NSArray的*)sectionIndexTitlesForTableView:(UITableView的*)的tableView {\t \t \t 的NSArray * fetchedObjects = [fetchedResultsController_ sectionIndexTitles]; \t return fetchedObjects; } – OscarTheGrouch
效果很好。谢谢你的帮助! – OscarTheGrouch