0

Getting the message:

static table views are only valid when embedded in uitableview controller instances

but in my ViewController which is the datasource of my tableview i just have

import UIKit

class ViewController: UITableViewController {

    override func viewDidLoad() {

        super.viewDidLoad()

    }

}

I have cleaned the project and run it again without any luck.

alex
  • 4,804
  • 14
  • 51
  • 86
  • possible duplicate of [Want to create a cool static UI but : "Static table views are only valid..."](http://stackoverflow.com/questions/9277473/want-to-create-a-cool-static-ui-but-static-table-views-are-only-valid) – Anbu.Karthik Sep 07 '15 at 12:40

1 Answers1

1

Your UI MUST be set up in a Storyboard for static table. Also the object used in the Storyboard must be a UITableViewController. You can verify this in the identity inspector (third one, where you can set a custom class). If you clear out the custom class for a moment, the default value should be UITableViewController. If its not, you should drag over a Table View Controller and move your views to using that.

Rafael Nobre
  • 5,062
  • 40
  • 40
  • i have done that, will try a fresh project as this was a dynamic table which i tried to convert to a static one – alex Sep 07 '15 at 12:47
  • Are you sure the object used in ib is a table view controller and not a view controller? – Rafael Nobre Sep 07 '15 at 12:55
  • i am new to swift where in the interface builder can i check this? I check the yellow circle-with-white-square and it points to the view controller class but i don't see where i can check the object sort? – alex Sep 07 '15 at 13:05
  • 1
    In the identity inspector (third one, where you can set a custom class). If you clear out the custom class for a moment, the default value should be UITableViewController. If its not, you should replace it with another instance that is a Table View Controller – Rafael Nobre Sep 07 '15 at 13:09
  • wow indeed it says "UIViewController" and not UITableViewController. How can i replace this or should i drag and drop a new Table view Controller? – alex Sep 07 '15 at 13:47
  • 1
    You can't change it, you should drag a new Table View Controller then move your view over if it has anything you need in the old. Don't forget to set the custom class to the class you have in code! – Rafael Nobre Sep 07 '15 at 13:49