Múltiples vistas de tabla en un TableViewController

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 varias vistas de tabla en una vista 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 contenido estático y prototipo en una vista de tabla 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.

¿Alguien sabe tampoco:

  • 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?

preguntado el 24 de agosto de 12 a las 19:08

May be similar to your question .. stackoverflow.com/questions/8945728/… -

Thanks for the link, looks like one of the ideas there are going to work for me. Kinda ashamed I wasn't able to find that one for myself, I was looking for something like that on here for quite a while. -

1 Respuestas

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.

respondido 15 nov., 12:15

My customer requires all three tables to be visible at the same time (which means navigation & tabbar are out), so the point of my approach is giving my customer what they are asking for, instead of trying to tell them they aren't asking for the right thing =). Split controllers only have room for 2 views, so I'd still have to try to split one of those into 2 tableviews anyway, which would bring me to the same point I was at. - General Mike

I wasn't aware of the custom controller container method you mentioned, so thank you for that link, and I'll take a look at it. As it is, I ended up switching to prototype cells for this particular page, but the custom controller container may be something I will want to use in the future. - General Mike

With controller container you can create the same layout as splitview controller, but you can do much more. You can place 3 table out, you can nested them into navigationcontrollers one by one, or you can combine theme with UITabbarController. - János

Yeah, I was reading that in the the link @MatthiasBauch posted. I haven't had time to check out WWDC 2011 yet, but it looks promising. Thanks for the help. - General Mike

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.