I’m trying to create a view that’s going to have 3 separate tables on it, one on the left side and two on the right (one above the other). All three are going to use static cells. I tried setting this up using a normal View Controller, and dropping 3 Table Views into it, but when I switch them over to static cells, I get errors saying “Static table views are only valid when embedded in UITableViewController instances”. If I try starting with a Table View Controller, it comes loaded with a full screen Table View, and I can’t find a way to re-size it to only half the screen so I can get the other 2 Table Views I need onto the page.
I did find another post called several tableviews in one view when I was looking into this. One of the comments to the question mention that it is possible to add extra table views to a Table View Controller, but the post just says “it’s hard”, and doesn’t elaborate any or provide a link, and I wasn’t able to find any more about it.
At the same time, some of the answers in Combine static and prototype content in a table view say that it is not possible to have multiple Table Views in a Table View Controller, but once again, there is no supporting documentation as to how the poster knows that.
Does anyone know either:
- how to add additional table views to a Table View Controller, or
- a work around to the “Static table views are only valid when embedded in UITableViewController instances” error?
Your approach has no point. Why don’t you create different controllers to each of the tableviews?
I think you want to use one of the standard provided controller container (split-, navigation-, tabbarcontroll), and you want to add more nested tableview to one of the container. But what you really need is a custom controller container architecture. Check out WWDC 2011 ‘Implementing UIViewController Containment’. With this approach from iOS5 it is possible to arrange as many UITableView on the window as you want. It is fully customizable.