Dide van Berkel Dide van Berkel - 1 year ago 179
Swift Question

UITableview Scrolls to Top on Reload

I am facing problem in my app - you can post and edit your favorite places. After posting a post, or editing a specific post (

is reloaded.

My problem is: the
scrolls to the top after reloading. But that's not what I want. I want my view to stay on the cell / view where I was. But I don't know how to manage that.

Could you help me?

Answer Source

The UITableView's reloadData() method is explicitly a force reload of the entire tableView. It works well, but is usually jarring and a bad user experience if you're going to do that with a tableview that the user is currently looking at.

Instead, take a look at reloadRowsAtIndexPaths(_:withRowAnimation:) and reloadSections(_:withRowAnimation:) in the documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download