- (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
セットを空にしてリロードし、疑似ヘッダーのみを表示する) と、問題はそれほど深刻ではなくなりますが、問題は解決しません。
編集:
初期読み込み:スクリーンショット
リロード後:スクリーンショット
iPadアプリなので画像ではなくリンクです。
テスト用にダミー コンテンツを使用します。
これは何か助けになりますか?深刻な問題を解決するにはさらに多くのコードが必要であることはわかっていますが、ビュー全体のコードへのリンクを除いて、他に何を追加すればよいかわかりません。