I have a table view that automatically scrolls in my iPad application (OS X 10.7.3, Xcode 4.3.2) and is not sure where to look for the cause. Here is the situation:
A UITableView fills the entire screen, and most cells are fixed height cells. The one exception is a cell that contains a UITextView and has a dynamic height (or, in other words, the height of the cell is adjusted to match the amount of text).
The problem appears if the table is faced with the fact that the dynamic height cell will be disabled when the table view is at the top. When the view is first loaded, the table is drawn as usual, only the visible part of the UITextView cell. However, if I show the UIPopoverController, I need to do reloadData after the popover rejects, and when I do this, the table view will scroll down enough to show the entire UITextView. (Not the cell containing the UITextView, you like it, only the UITextView. The table is a grouped table, and the UITextView is the only cell in this section, so the rounded bottom edge still doesn't appear after scrolling through the phantom.)
I do not see any code in my application that scrolls the table view or sets the content offset, so I am completely confused about what might be causing this.
To try to narrow it down, I set my mind to respect UIScrollViewDelegate, and if I set a breakpoint in the scrollViewDidScroll method: the program will really stop after the popover leaves and gives me the following backtrace:
(lldb) bt * thread #1: tid = 0x1f03, 0x0005245f MyApp`-[ContactDisplayViewController scrollViewDidScroll:] + 31 at ContactDisplayViewController.m:1143, stop reason = breakpoint 3.1 frame #0: 0x0005245f MyApp`-[ContactDisplayViewController scrollViewDidScroll:] + 31 at ContactDisplayViewController.m:1143 frame #1: 0x017e3494 UIKit`-[UIScrollView setContentOffset:] + 521 frame #2: 0x0180804d UIKit`-[UITableView setContentOffset:] + 334 frame #3: 0x017d495e UIKit`-[UIScrollViewScrollAnimation setProgress:] + 523 frame #4: 0x0183d234 UIKit`-[UIAnimator(Static) _advance:] + 255 frame #5: 0x02c013a3 GraphicsServices`HeartbeatTimerCallback + 35 frame #6: 0x023278c3 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19 frame #7: 0x02328e74 CoreFoundation`__CFRunLoopDoTimer + 1220 frame #8: 0x022852c9 CoreFoundation`__CFRunLoopRun + 1817 frame #9: 0x02284840 CoreFoundation`CFRunLoopRunSpecific + 208 frame #10: 0x02284761 CoreFoundation`CFRunLoopRunInMode + 97 frame #11: 0x02bfe1c4 GraphicsServices`GSEventRunModal + 217 frame #12: 0x02bfe289 GraphicsServices`GSEventRun + 115 frame #13: 0x017a4c93 UIKit`UIApplicationMain + 1160 frame #14: 0x0000263d MyApp`main + 125 at main.m:14
And if I print scrollView in this method, it will show that the UITableView is in motion (not sure where the contentOffset is coming from):
Printing description of scrollView: <UITableView: 0xc3ed400; frame = (0 99; 383 817); clipsToBounds = YES; autoresize = W+RM+H; layer = <CALayer: 0x7bf1a40>; contentOffset: {0, 14}>
This phantom scroll is displayed on the device and the simulator, as well as on iOS 4.3, 5.0 and 5.1. Does anyone have any ideas?