Reputation: 6606
I have a UIViewController in my Storyboard and in that I have a UIView which contains a UITableView.
I added another small UIView into the top of the UITableView which contains some buttons and text.
Basically, when the run the app, the UIView which I have placed in the UITableView goes to the bottom of the UITableView for some reason.... It scrolls perfectly with the UITableView, but it stays at the bottom...
How can I get the inserted UIView to stay at the top of my UITableView and still scroll with the UITableView?
Thanks, Dan.
Upvotes: 0
Views: 2359
Reputation: 9915
What you're describing is the table view header. You don't add it to the table directly, but rather, you assign it to the table's tableHeaderView
property like this:
self.tableView.tableHeaderView = myHeaderView;
Or you can just drag and drop a view into the storyboard at the top of the table view above the first section.
Upvotes: 2