views:

828

answers:

2

Hi,

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? Thank you.

+1  A: 

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.

OscarMk
I need to put more than the text header that UITableView provides. It's going to be a 100px or so high area with a person's picture in the left side and some details on the right. The table view beneath the header will be a listing of the person's posts to a company blog. So that's why I need a header area separate from the UITableView.
Dan Brown
Then the best approach would be to make the table smaller. Make sure the View Controllers property "view" is an actual UIView and not a UITableView that way you can first drag a UITableView to the UIView and then drag the borders to the desired size.
OscarMk
+1  A: 

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.

Mihir Mathuria