Connecting UITableView to UIView error

Sorry if the question is a beginner, this is because I'm a beginner.

I have a nib file called HistoryLogTableViewController

. in this nib file i have UIView and UITableView, UIView is the parent of UITableView.

HistoryLogTableViewController

screenshot:

enter image description here

This nib file has a view controller HistoryLogTableViewController

that has a table view property in the .h file that is associated with the owner of the files, it looks like this:

enter image description here

and this property in the .h file:

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

      

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

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

+3


source to share


1 answer


I am assuming your class looks like this

@interface HistoryLogTableViewController : UITableViewController

A UITableViewController

MUST have UITableView

a controller view as the root view, not UIView

.



change it to

@interface HistoryLogTableViewController : UIViewController

and it should stop crashing.

+2


source







All Articles