Fay007 Fay007 - 1 month ago 6
iOS Question

reloadSections in UITableView bounces to top

In my

after certain change to model i am trying to load the specific section in where my cells are getting loaded according to the model. But whenever the change happens there comes error with animation, which is like bouncing to top or down. how do i resolve it? So far nothing worked. This is how i am updating my section after api response:

DispatchQueue.main.async {

self.tableView.reloadSections(indexSet, with: .none)


Answer Source

Because i had images of different sizes my tableview could not adjust the height calculation while reloading the table. So i have tried to pre calculate the previous height and adjust it to the new one. While implementing the thing it came to my mind that i can update the table from my cell and calling layoutIfNeededwould do the trick. So eventually it worked.