0

I have 4 sections in tableview. I am reloading section using :

[self.tableview reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

What happens, when i observe cells in section 2 and my code runs to reload section 1; tableView position gets up. I want tableView position to be maintained, when any section in table is reloading.At the same time, I don't want any animation for tableview, when table is reloading. Thanks!

Uma Madhavi
  • 4,851
  • 5
  • 38
  • 73
Saggy
  • 465
  • 5
  • 18
  • If your table is scrolling after reloading the section, just use row animation "UITableViewRowAnimationNone" with reloadSections method. – Shardul Mar 18 '16 at 11:51
  • @Shardul : i am using same row animation only; but it still animating. – Saggy Mar 19 '16 at 12:17
  • I got solution, as i am using the cell sized tableviewCells, i need to implement estimatedRowHeight() delegate method. And need to specify the approx. cell height for each section. This helps me to fix this issue. – Saggy Jun 29 '16 at 14:06

2 Answers2

0

Try below Code:

        [self.tableView beginUpdates];

             NSRange range = NSMakeRange(0, 1);//Your section number instead of 1
             NSIndexSet *section = [NSIndexSet indexSetWithIndexesInRange:range];
             [self.tableView reloadSections:section withRowAnimation:UITableViewRowAnimationNone];

        [self.tableView endUpdates];
Ronak Chaniyara
  • 5,335
  • 3
  • 24
  • 51
0
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
Sabby
  • 403
  • 3
  • 15