Reputation: 3889
Often I see layouts on the iPhone like the one I attached.
How is this done best? With Interface builder or programmatically? How do i add a subview to the UITableView without occluding the actual table cells (i.e how do i set a margin to have space for subviews)?
Using Xcode4.2.
Upvotes: 0
Views: 858
Reputation: 52227
A tableView has a header and footer and every section has those too.
to set the tableview's hear and footer (in my screenshot green), do:
[self.tableView setTableHeaderView: headerView];
[self.tableView setTableFooterView: footerView];
for header and footer for sections (blue), youl'll have to implement
-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
and
-(UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
The code of the shown program you'll find at github
Upvotes: 2
Reputation: 361
Your best best would be to use interface builder. You can use interface builder to connect all of the actions to your code visually.
You can also use interface builder to change the positioning of the subview.
I hope this helps!
Upvotes: 0
Reputation: 53551
This is usually done with the tableHeaderView
and tableFooterView
properties of the table view.
Upvotes: 1
Reputation: 14053
The non-cell areas are usually done as section header and footer views.
Upvotes: 0