I had added a UITableView footer In Section and made a custom view for it. I have a checkbox in the custom view. The problem is that I had checked the checkbox and when I scroll down the footerview gets refreshed and the checkbox will be unchecked. Is there a way that I can stop the unchecking the checkbox while i scroll the table?
-
2Hold the checkbox state in a boolean variable. Update the checkbox state according to the variable when adding the footer to the table. – Muzahid Nov 27 '19 at 06:26
3 Answers
Update your datasource with the selection and use the same data when scroll back to show the previous status.

- 1,047
- 8
- 12
You need to handle it, Like Cell dequeued same way header and footer also dequeued you need to user reuse Identifier check the below answer, you will get the hint.
The below link will not give an exact answer but you can get a hint. How to Implement Custom Table View Section Headers and Footers with Storyboard

- 5,020
- 4
- 49
- 75
There is a RULE for UITableView/UICollectionView. If you are displaying some data into these controls then YOU MUST KEEP your data/state into your Model.
The reason of this rule is these controls take only one cell and REUSE that cell. So you have to maintain your data or state of controls into your model i.e. State of checkbox in your case.

- 412
- 1
- 5
- 16