【发布时间】:2010-06-12 03:44:42
【问题描述】:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
if ([tempArray containsObject: [sectionInfo indexTitle]])
{
[tempArray removeObjectAtIndex:[tempArray indexOfObject:[sectionInfo indexTitle]]];
return nil;
}else
{
[tempArray addObject: [sectionInfo indexTitle]];
return [sectionInfo indexTitle];
}
return [sectionInfo indexTitle];
}
上面的代码按字母顺序对单元格进行分组,但显示一个空白的灰色标题而不是适当的标题。这可能是因为我没有指定标题的数量吗?这自然是字母表中每个字母的单个标题。任何其他想法为什么单元格标题会在我滚动时闪烁白色到灰色,灰色到白色?
【问题讨论】:
-
似乎如果我为 3.2 构建,它可以使用上面的逻辑。如果我使用 3.1.2 构建(我正在这样做),则会出现错误。
标签: iphone objective-c