Jacksonkr
Jacksonkr

Reputation: 32207

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?

Upvotes: 2

Views: 1326

Answers (2)

danypata
danypata

Reputation: 10175

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

Upvotes: 6

Pfitz
Pfitz

Reputation: 7344

Maybe you can do something like this

containerView
    |
    |--- headerView (subview of containerView)
    | 
    |--- tableView/scrollView (subview of containerView)

so you separate the headerView from the tableview and the scrollView indicator will just be on the tableView. This is assuming you mean a table view header and not a section header.

Upvotes: 0

Related Questions