开发者

UITableView section headers are blank and flickering

开发者 https://www.devze.com 2023-01-02 23:27 出处:网络
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtInd
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];

if ([tempArray containsObject: [sectionInfo indexTitle]])
{
    [tempArray removeObjectAtIndex:[temp开发者_如何学GoArray indexOfObject:[sectionInfo indexTitle]]];     
    return nil;
}else
{
    [tempArray addObject: [sectionInfo indexTitle]];
    return [sectionInfo indexTitle];

}
return [sectionInfo indexTitle];

}

The code above groups the cells in alphabetical order but displays a blank gray header instead of the appropriate title. Could this possibly be because I did not specify the number of headers? This would naturally be a single header for every letter in the alphabet. Any other ideas why the cell headers would flicker white to gray, gray to white as I scrolled?


Repeated calls to tableView:titleForHeaderInSection: appear to return alternately [sectionInfo indexTitle] and nil. Why are you surprised?

0

精彩评论

暂无评论...
验证码 换一张
取 消