In a tableview’s section. I have some selectable rows.
Inside the section’s header I have a Deselect All
button.
The deselect all
button needs to get enabled if a row is selected and disabled if no row is selected.
The button is enabled/disabled by reading a boolean value. I have a didSet
on that boolean:
var shouldEnableDeselectButton = false
{
didSet{
if oldValue != shouldEnableDeselectButton{
DispatchQueue.main.async {
self.notesTable.reloadSections([self.indexofFilter], with: .none)
}
}
}
}
- If I do absolutely nothing in the
didSet
then it only gets updated by being dequeued/scrolling up or down and getting off the screen. See below:
- If I do
self.notesTable.reloadSections([someSection], with: .none)
then it longer requires the section header to get dequeued. Yet if I select one of the last rows, then it jitters badly: See below:
I looked online and found solutions mentioned Reload tableview section without scroll or animation but they both still jitter