Want to create a cool static UI but : "Static table views are only valid..."

40,746

Solution 1

Add a UITableViewController to your view. It should hold a UITableView. Define this as a static table view, and make it grouped. Add two sections. One with one row, and the other with two rows. Add your Labels buttons and sliders to the rows again.

I do not know why you would want to have two UITableViews here?

Solution 2

I've also ran into an issue when changing an existing custom view controller, making it extends UITableViewController. XCode isn't smart enough and won't realize it already fits its requirements.

You can solve this problem by editing storyboard source code and changing <viewController ... to <tableViewController....

Original source: https://plus.google.com/108665969482300807329/posts/J4mCASMA3pZ

Solution 3

The only way to make this work in Xcode 6, and the way Apple intended this to work is to embed a TableViewController in a container view, if you must. It seems that you cannot hack your way through as described by juanignaciosl, in Xcode 6.

So the steps would be as follows:

  1. Create a table view controller
  2. replace the table view in this controller with the table from your "problematic" view controller, with all its static cells and so on

If your table view is part of a more complex ui and it is not the main view of your view controller then continue as below

  1. create a containerView in your "problematic" view controller, in the same position as your now-moved static table view. This will also create automatically another viewcontroller and a seque - delete those.
  2. left click drag or ctrl drag from the container view to the tableviewcontroller which contains your static table and choose embed

This is not as nice as before, because your tableview is stripped away in a separate view controller in interface builder and this might have an impact on your existing code and outlets. But for big static tables it is the better alternative to generating all the content dynamically.

Solution 4

You can make it dynamic and then switch of scrolling:

[yourTableName setScrollEnabled:NO];
Share:
40,746
Cehm
Author by

Cehm

Updated on July 20, 2022

Comments

  • Cehm
    Cehm almost 2 years

    I'm creating a view like:

    enter image description here

    For this I'm trying to use a Storyboard in which I add 2 TableViews (both as 'Static Cells') and then I manually add my Cell content directly from the storyboard...

    In my storyboard it looks great but when I build I get:

    en.lproj/MainStoryboard.storyboard: error: Illegal Configuration: Static table views are only valid when embedded in UITableViewController instances

    How can I fix this error?