I display an UITableView, and from time to time, the first row appears at the bottom of the view.
There is nothing above the first row, and the empty space isn’t touchable.
So far, I’ve checked:
- headerView of tableView : is empty
- use plain UITableViewCells
- check the rowHeight of the cells
- check the frame of the cells
- when the bug happens, there is no memory warning before
- check the contentOffset of the table scroll view
This bug appears only on the iPhone, never on the simulator.
The screenshot shows on the left the correct tableview, and on the right the view with the bug. When doing the snapshot, I touched the screen so the scroll bar is visible.
Any idea in what direction I should look?
I just saw the contentSize of the tableView scrollView is wrong: I have 84 cells @ 67 pixels and 1 cell @ 57 pixels height: total should be 5685 but is 6005. (off by 320). Strange.
Stephan
alt text http://www.quicksnapper.com/files/5161/18374733084A0B3EA24D152.png
So I found the solution to my problem:
Adding an NSLog(@””). This is weird.
In my viewWillAppear, I have
Adding the NSLog(@””) solves the bug.
Also reversing the test:
Instead of
I do:
I have absolutely no idea why this works (or why it doesnt work without the NSLog).