views:

1760

answers:

3

I have created a UITableView with multiple columns to display a Football League Table. Now what I really need is a header to label each column which will ideally sit at the top of the table view. How would I do this?

A: 

This is sort of a weird interface for an iPhone app, assuming you are trying to replicate the look and feel of an HTML table, with headings, cells and etc.

If this is what you want, why not just use a UIWebView object to display your table?

jpm
Because I am doing it with a UITableView
Xetius
+3  A: 

You could create a custom UIView and set it as the first section header of your UITableView. Return it in your UITableViewDelegate's tableView:viewForHeaderInSection: method. You simply need to design it so that it aligns with the "columns" inside your custom cells.

François P.
+1  A: 

Instead of setting it as the header for your first UITableView section, it would make more sense in your situation to set it as the header to your entire table. This can be done with the tableHeaderView property of UITableView. For example:

UIView *myHeaderView = ...
[myTableView setTableHeaderView:myHeaderView];
Sebastian Celis