UITableView scrolling to specific position

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-04-21T18:29:15Z Indexed on 2010/04/21 18:33 UTC
Read the original article Hit count: 626

I am using iPhone SDK 3.1.3. I have a UITableViewController which gets data from another controller. The tableview is added as a subview to the mainview but the frame is set so that it is not visible. The tableview frame is updated and made to slide over the main view by tapping on a button.

The table view appears and i scroll to the last row. if i select the last row, i reload the table with more data. The table gets updated with more data. everything works fine except the scroll position is always the top.

I need the scroll position to be the last row that I clicked on to load more data. I save the scroll position and call the following code after it loads more data. It executes without issues but the scroll position is always the top.

 [theTableView scrollTRowAtIndexPath:[NSIndexPath indexPathForRow:savedScrollPosition inSection:0] atScrollPosition:savedScrollPosition animated:NO];

The above seems to have no effect. ViewWillAppear: ViewDidAppear: does not fire and I am told that if the view controller is instantiated in code, which is the case, these don't fire.

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about uiscrollview