Reloading UITableView without reloading Section Header

595 Views Asked by At

I am using tableView in which I placed UISegmentedControl in Header of section as I have only one section in TableView. I reload the tableView when Segment change.

Now when I reload TableView then section header also reloaded and due to reloading of Section Header the UISegmentedControl is also recreated so loose its previous state (selected segment of UISegmentedControl).

So I want to ask is there any way to reload the TableView without reloading the Section Header?

1

There are 1 best solutions below

0
On

Use a variable to store state of UISegmentedControl. Assign 0 in viewDidLoad().

When user change state of then save the state in variable.

On reloading table use variable to get old state