2

What is the best way to prevent what you see in the first picture from happening, so that it does look like in the second picture, where Header 2 stays right beneath Header 1.

The reason I wanna do that is because of a "UI-Glitch" when animating the height of the tableView. (Described in more detail below :)

Header Clipped

Header not Clipped

In my other project I pinned the top of the tableView to another view (topView). When the user scrolls down, I set topView.heightConstraint.constant to a smaller value and animate the change in layout with UIView.animate - rootView.layoutIfNeeded().

The problem I'm facing is when the User scrolls down so fast / much, that Header 2 replaces Header 1 for a moment. It then looks like Header 1 is glitching beneath the topView a little bit and then reappearing again. (This doesn't take much scrolling velocity when there are only a few rows in Section 1)

So I want to prevent this from happening by keeping Header 2 beneath Header 1 as long as the animation has finished.

I tried to change the frame of the header with

tableView.headerView(forSection: 0)?.frame = /* New frame */

but couldn't get it to work... :(

Tysac
  • 257
  • 2
  • 11
  • As described in the end it causes a "UI-Glitch" which a don't like. I could live with the bug but it disturbs me every time it occurs. I will reference it at the top :) – Tysac Mar 20 '18 at 15:20

0 Answers0