views:

710

answers:

2

Is there a way to add custom views above and below a UITableView?

I'd like to have a custom header and a custom back button in the footer. What would be the best to do this?

I've started by subclassing UITableViewController and tried resizing the UITableView. In vain.

Tried adding a new main view to UITableViewController and adding the UITableView as a subview to it. Result: table view won't appear at all.

Tried adding the back button as a subview to the table view, but it will get scrolled this way.

Now I guess it would be the best to somehow replace the "original" header/footer, but is that possible?

Edit: Solved!

Using this tutorial, I've managed to add the required header and footer to the view using the Interface Builder.

+2  A: 

Shouldn't the UITableView's tableHeaderView and tableFooterView properties do just what you want?

MrMage
tableHeaderView / tableFooterView moves together with the contents of the table, so unfortunately it's no good for me.
shinjin
A: 

Ultimately I couldn't achieve what I wanted by code, but as noted in the edit of the original question, I was able to it using Interface Builder with the help of this tutorial.

shinjin