alex
alex

Reputation: 4924

swift/ios How to check if my table view is embedded in uitableview controller instance?

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.

Upvotes: 0

Views: 854

Answers (1)

Rafael Nobre
Rafael Nobre

Reputation: 5131

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.

Upvotes: 1

Related Questions