Example-HeaderScroll icon indicating copy to clipboard operation
Example-HeaderScroll copied to clipboard

Half image stick on top ?

Open atifsaeed14 opened this issue 4 years ago • 1 comments

@NachoMan is it possible stretch half of image and stick on top ?

atifsaeed14 avatar Jul 29 '20 12:07 atifsaeed14

Sure @atifsaeed14! It's pretty straightforward, but it will require a change to the view hierarchy for how the header is added. The approach I describe here embeds the header view into the table's background. So the header peeks through from where table content doesn't show. So as the table is scrolled, the cells overlap and subsequently overlay the header.

Instead I would suggest adding both the header view and the table view to a common superview (using UIViewController instead of UITableViewController), and then ensure the header view is in the front.

In this way you can use the contentInsets to adjust the starting point of the table content to ensure the header is visible, and you can adjust the height of the header view, but leave its origin at (0,0). All that remains is making sure you only adjust the header to some minimum height.

AlexAstroCat avatar Sep 02 '20 18:09 AlexAstroCat