Home > database >  How to dynamically change UITableView section header with scrolling. Or how to add a button to table
How to dynamically change UITableView section header with scrolling. Or how to add a button to table

Time:07-11

The default behavior for UITableView section headers is to stick to the top edge of the table and slightly change background to a thin material.

I need to add a button to the section header, so, as I understand, I need to write my own custom header with the viewForHeaderInSection. How do I replicate the default behavior of changing the background to a thin material? How do I detect that the section header hit the top edge of the table and force to change the view's background?

Alternatively, how can I add a button to the standard header without writing my own?

CodePudding user response:

Creating a simple subclass of UITableViewHeaderFooterView helped. It kept all the standard behavior and visuals, while I just added a button on top.

  • Related