【问题标题】:UITableView Index without magnifying glass不带放大镜的 UITableView 索引
【发布时间】:2011-09-18 13:09:33
【问题描述】:

我正在尝试创建一个没有放大镜图标的索引 UITableView。 我意识到 UITableViewIndexSearch 正在索引中创建图标,但我不知道用什么替换它。任何帮助或建议将不胜感激。

- (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];}

【问题讨论】:

    标签: iphone objective-c cocoa-touch


    【解决方案1】:

    只需将其替换为空即可。只需将 UITableViewIndexSearch 常量从您的数组中删除即可。

    【讨论】:

      【解决方案2】:

      不要在sectionIndexTitlesForTableView: 中添加UITableViewIndexSearch。只需从 fetchedResultsController 返回数组。

      【讨论】:

      • - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { NSArray *fetchedObjects = [fetchedResultsController_ sectionIndexTitles];返回获取的对象; }
      猜你喜欢
      • 2010-09-19
      • 2012-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多