4

I have developed a split view based applicaiton. And i am trying to add image to root view controller.

For that i made RootView.xib manually and in MainWindow.xib I loaded rootViewController with this xib. But when i try building this i get this error.

Any help in this approach OR any other approach to add image to root view controller will be greatly apprecviated

AmitMugal
  • 43
  • 1
  • 6

2 Answers2

23

You probably have to change the super-class of your rootViewController from UITableViewController to UIViewController.

Dominik Seibold
  • 2,439
  • 1
  • 23
  • 29
  • 4
    The reason is that the nib-loading-function expects that the view-property of an UITableViewController is wired up to an UITableView. It wasn't the case in your case, so that exception was thrown. An UIViewController doesn't expect an UITableView, but just an UIView. It seems that this was the case in your case, so it worked. – Dominik Seibold Dec 01 '10 at 09:54
  • Thanks Dominik. I was having the same issue since yesterday and your one line answer solved it in two seconds. +1 from me. – Varundroid Sep 05 '11 at 16:12
7

If you subclass a UITableViewController on purpose, you need to change it's default view load behaviour just by overriding it's load view method:

- (void)loadView {
    [super loadView];
}
der_michael
  • 3,151
  • 1
  • 24
  • 43