Storyboard "Main", but didn't get a UITableView when using UITableViewController
Solution 1
In your storyboard, you need to make the root view of your UITableViewController
a UITableView
.
Solution 2
Try changing your super class to UIViewController or change the controller in your storyboard to TableView Controller
@interface MTViewController : UIViewController, UITableViewDataSource, UITableViewDelegate
@end
Solution 3
I met exactly the same issue as you. You're probably using a UIViewController instead of a UITableViewController in the storyboard.
NOTE: Only subclass a custom UITableViewController in the storyboard is not enough. You'll see the difference: difference between UIViewController and UITableViewController
So you have to drag out a UITableViewController from the library, then move all things(cells) to it. Don't forget to check bindings and auto layouts if broken.
And of course you cannot move the tableview to the root of UIViewController, it just doesn't work like that. =)
Solution 4
Drag a new instance of Table View Controller into your storyboard, copy the cells you created in your previous controller into the new one.
This error occurred probably because you used the default UIViewController created by XCode which isn't a UITableViewController.
Solution 5
Actually you are using UIViewController not UITableViewController. Delete your default view controller and drag new TableViewController in your storyboard. Because your ViewController not having TableView, but it's trying to load cells.
Simple solution is : Delete ViewController and add TableViewController
Then you have to change its class name to MTViewController or Your Class Name
Fred Shmed
Updated on November 08, 2021Comments
-
Fred Shmed over 2 years
I have been going through this tutorial, "Option 2: Prototype Cells" I implimented all the steps, but, the following code gives me an error:
@interface MTViewController : UITableViewController @end
the error message is:
instantiated view controller with identifier "UIViewController-BYZ-38-t0r" from storyboard "Main", but didn't get a UITableView.'
Here is what I tried - I changed
UITableViewController
toUIViewController
and the error went away. But, the tableview remains blank. Can you tell me why this is ?-
Bob over 8 yearsWhat do you mean blank? When you add a View Controller to your storyboard it's vanilla. You have to add the elements to it.
-
-
mobibob over 6 yearsvery subtle problem and obvious solution (assuming you appreciate the problem). now, why are my cell properties coming back NIL?
-
pulp over 6 yearsthis is wierd but it's true. Had the same problem, solved like you described
-
Nico Haase almost 6 yearsCan you be more precise, or even share some code that helps to understand your answer?
-
Danish Ali about 5 yearsUse comment for this kind of info.