I have a root view controller with no nib file,
I tried adding this at cellForRowAtIndexPath as that passes in a UITableView as tableView.
So I put :
tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
It ran with no error but it didnt seem to change anything.
Your code snippit won’t change anything, because the
-tableView:cellForRowAtIndexPath:method is only called when an existing table view needs to know how to draw its content. No existing table view, no getting called.Remove that line from your
-tableView:cellForRowAtIndexPath:method, and define aUITableViewobject either:As @FenchKiss Dev wrote, if you set up the table in code you need to add it as a subview to an existing view, for it to be displayed.