0

I am new to iPhone programming and I am stuck on a problem. I have implemented the section headers and rows in a UITableView where I am expanding and collapsing the rows on clicking the section header. But the problem is this: when the rows are expanding on clicking the section header, and the scrolling rows are going underneath the section headers. I want to scroll both the rows and section headers, and it should not go under the section header. How can I achieve the desired effect?

msgambel
  • 7,270
  • 4
  • 44
  • 61

1 Answers1

0

I think you forgot calling the following methods after you updated your data source:

To add rows:

[self.tableView insertRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:<#(UITableViewRowAnimation)#>];

To remove rows:

[self.tableView deleteRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:<#(UITableViewRowAnimation)#>];

Also you may need

[self.tableView insertSections:<#(NSIndexSet *)#> withRowAnimation:<#(UITableViewRowAnimation)#>];

and

 [self.tableView deleteSections:<#(NSIndexSet *)#> withRowAnimation:<#(UITableViewRowAnimation)#>];

Rows under section when expanding and scrolling

VisioN
  • 138,460
  • 30
  • 271
  • 271
Thomas Kekeisen
  • 4,449
  • 4
  • 34
  • 54