Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting UITableView to UIView error

sorry if the question is a beginners one its because I am a beginner.

I have a nib file that called HistoryLogTableViewController. in this nib file I have a UIView and a UITableView, the UIView is the parent of the UITableView.

HistoryLogTableViewController screenshot:

enter image description here

This nib file have a view controller called HistoryLogTableViewController that have a table view property in the .h file that is connected to the files owner, it looks like this:

enter image description here

and this is the property in the .h file:

@property (strong, nonatomic) IBOutlet UITableView *tableView;

now from what I knew if I run the app now it should work...just load an empty table view...but when I click on the button that opens this table view the app crashes and I get this error:

reason: '-[UITableViewController loadView] loaded the "HistoryLogTableViewController" nib but didn't get a UITableView.'

like image 809
nick shmick Avatar asked May 20 '26 13:05

nick shmick


1 Answers

Im guessing your class looks like this

@interface HistoryLogTableViewController : UITableViewController

A UITableViewController MUST have a UITableView as the root view of the controller not a UIView.

change it to this

@interface HistoryLogTableViewController : UIViewController

and it should stop crashing.

like image 113
Warren Burton Avatar answered May 23 '26 05:05

Warren Burton