iPhone UITableView with a header area

Viewed 63811

I have a view that was created with all of the default UITableView stuff, but now I need to add a header area above where the UITableView is (so the UITableView will scroll normally, but the top 100px of the screen or so will have static header content). I don't see where I can resize the UITableView in IB, and am not sure how to do this.

Does anyone know?

8 Answers

Why don't you use the UITableView provided header?. As follow:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

{
     return @"My Title";
}

Additionally you may resize your table view in IB by dragging the borders.

You will have to embed the UITableView in a UIView alongwith another view (which you are referring to as header section).

So, the UIView will have 2 subviews. The header view followed by the table view.

  • UIView(parent)
    • UIView (header)
    • UITableView (table)

Hope this helps.

Related