Search code examples
iosios5uiscrollviewuitableview

TableView scroll indicator overlaps header


iphone app table header

Situation

The TableView does everything I need it to because it

  1. Allows me to animate rows into it (not easily accomplished with a UIView)
  2. Allows for a non-scrolling header up top.

Problems

  1. The scroll indicator (top right) is covering the header. I expected it to stop at the bottom of the header but that's not the case apparently.
  2. If I allow bouncing and you pull down too far, the header pulls down with the content. That's not okay.

Realization

I can fix my current problems by switching to a UIView, but then other problems are introduced.

  1. If I animate rows in with a UIView, I have to keep track of all views positions and make sure they all move by the correct distance when a new view is introduced.
  2. 1 isn't so bad, but factor in the matter of screen rotation and it becomes a nice place for bugs to make a home.

Question

How can I resolve this?


Solution

  • For the scroll indicator you can use:

     tableView.scrollIndicatorInsets = UIEdgeInsetsMake(yourHeaderHeight, 0, 0, 0);
    

    If you don't want the header to move when the table view bouncing is enabled you should replace the header with a UIView and the table view should start at the bottom of the UIView