- (UITableViewCell *)tableView:... cellForRowAtIndexPath:... {
// init and sanity check
if (indexPath.row == 0) {
// make cell look like a section header
// easier and less complex than using a custom header view
NSLog(@"header");
// should prove that only four cells get the bg image
// and yet, almost every time the table is reloaded
// one more cell unexpectedly gets the background
// without putting another line in the debugger
} else {
// normal cells after row 0
// BUG: some of these are getting the row 0 background
NSLog(@"row");
// firing exactly the right number of times --
// once for each row with an index greater than 0
// so why are some of these cells getting the header bg?
// when these cells get the headers' contents
// they behave exactly as one would expect
// except that they should be the normal rows
}
// misc stuff, not causing problems
return cell;
}
没有强迫用户完全重新启动应用程序只是为了将不同的数据转储到表中,我不知道如何修复这个错误。
如果我折叠每个部分(即清空expandedSections
集合并重新加载,只留下伪标题可见),问题就不那么严重了,但它并没有消失。
编辑:
初始加载:screenshot
重新加载后:screenshot
链接而不是图像,因为它是一个 iPad 应用程序。
使用一些虚拟内容进行测试。
这有什么帮助吗?我知道需要更多代码才能获得真正的帮助,但我不知道还要添加什么,缺少指向整个视图代码的链接。