I want to have a ViewController that has a table view on the top half of the screen, and a button under it. I’m assuming there’s a simple way to do this. Every way I have tried so far ends up in the bottom half of the view being inaccessible.
Share
The trick is that you cannot use a subclass of
UITableViewController. You need to enable thedatasourceanddelegateprotocols explicitly in aUIViewController.Don’t forget to assign
selfasdelegateanddatasourceof your tableview.Now you can just put the table view anywhere by giving it an appropriate
frameand you can also put a button at the bottom.Hint: the standard way to “put a button at the bottom” is to use a
UIToolBar. With that you could use the normal table view controller without having to worry about the protocols. But your approach is also feasible.