0
votes

I have implemented a TableView with multiple sections and a section headers and section footers in each section. When the user tapes one cell more cells are inserted in an animated fashion. To implement this I update the data model and call

 [self.tableView insertRowsAtIndexPaths:addedIndexPaths withRowAnimation:(UITableViewRowAnimationTop)];

On the top rows this works as expect: The aded rows animate and the content ofset of the tableview is constant. On the last cell the tableview scrolls either to the top of the previous section or to the top of the footer of the previous section.

Why does the tableview scroll when I insert rows? How can I prevent that scrolling while keeping the animation?

1
override scrollview delegate methods - Prashant Tukadiya
@PKT Which one in particular? I tried to enable disable the scrolling and enable it right after the insertion, but that did not work either. - HasenBaumeister
@PKT I do not use a RefreshControl and don't call reloadData - HasenBaumeister

1 Answers

1
votes

The main way around this is to not use insertRowsAtIndexPaths. Instead try using reloadSections in order to keep the animations.