Why isn't my UITableView appearing in the correct scroll position?

Posted by zbrimhall on Stack Overflow See other posts from Stack Overflow or by zbrimhall
Published on 2010-05-09T05:24:50Z Indexed on 2010/05/09 5:38 UTC
Read the original article Hit count: 252

I have a split view-based app that presents a master-detail interface, and uses a popover to present the master list when in portrait mode. The popover presents a sectioned table view that ultimately gets populated by a subclass of NSFetchedResultsController. I can tap the tool bar button to present the master list, scroll to whatever row, and tap the row to dismiss the popover.

My problem is that if the table is scrolled past the top of the second section, when I dismiss the popover and then later tap the toolbar button to re-present it, the table's scroll position is always set such that the first row of the second section is at the top of the list. If I haven't scrolled past the top of the second section, it correctly remembers its scroll position when the table is presented again.

Similarly, in landscape mode, if I scroll the table past the top of the third section and then rotate to portrait, when I come back to landscape the scroll position is always set such that the first row of the third section is at the top of the list.

I tried calling -scrollToNearestSelectedRowAtScrollPosition:animated in both the master view controller's -viewWillAppear, as well as in the split view delegate's splitViewController:popoverController:willPresentViewController:, to no effect. Anybody have a clue what I might be doing wrong?

© Stack Overflow or respective owner

Related posts about ipad

Related posts about iphone