how do i use my custom section header to respond to a page scroll?

You can put your label inside a custom subclass of UITableViewHeaderFooterView which does it automatically for you,

Apologies, I only know Swift, but here are the steps explained:

  1. Create your custom header class: enter image description here

  2. Next, register it to your tableview in viewDidLoad: enter image description here

  3. And, finally use it inside your viewForHeaderInSection: enter image description here

Basically, create a custom subclass of UITableViewHeaderFooterView (in code or using nib), configure and add your label as a subview to the header’s contentView, register the custom header to your tableview, and then call it in the delegate method

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top