12

I'm about at the end of my rope with this freaking project!!!!!!!

I have a UIViewController class that is linked to a nib that has a tabbar controller with 2 tabs. Both tabs load nib files. When I compile I get an error:

-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MainViewController" nib but the view outlet was not set.

What's going on here? MainViewController views are being populated by nib files (and those files views are linked correctly).MainViewController's Files's Owner has a parameter "view" but shouldnt that be ignored since Im loading both views from a nib? ANY help would be appreciated!

3 Answers 3

36

I had the same error (loaded the "xViewController" nib but the view outlet was not set.) in the debugger.

In Interface Builder, I opened the xViewController.xib, right-clicked the View icon, dragged from the circle beside New Referencing Outlet over to the File's Owner icon, then, when the small gray menu appeared, I clicked view. (Then save, rebuild, run, etc...)

I'm not clear on what's going on, but that fixed it.

From what I understand, if anybody wants to follow-up, the View's outlet (which is named "view") was not set, and by dragging the New Referencing Outlet over to the File's Owner icon, I set the View's outlet. Great.

1
  • Thanks! I hit this and your suggestion solved my problem. Actually solved the view outlet set not problem and a view that was showing the picker but no labels or buttons.
    – Refactor
    Nov 3, 2010 at 2:17
2

Issue #1 - nib but the view outlet was not set. 1. My MainMenu.xib that had the tabbarcontroller, it's File's owner MUST be connected to some sort of view. So putting in a view object and linking it is fine. I was getting annoyed because it kept showing that file and not the tabbar. #2 solves that problem

Issue #2 - no tabbar being shown 2. Create an IBOutlet UITabBarController and link that to the files owner. And then in the viewdidload method do this self.view = tbController.view; and now your tabbar is being shown not that blank view file you linked to!

0

You need to add the view from each external nib to the main xib and then connect the view outlet to the correct view. For example, if you have the tab bar in MainMenu.xib and an external xib named ViewOne.xib then open both of them, drag Custom View (or whatever it's called) from the ViewOne.xib window to the MainMenu.xib window. Then connect the view outlet of the tab for that view to Custom View. You should probably rename Custom View once you copy it to MainMenu.xib so that can tell it apart from the other views you will have to add to MainMenu.xib.

3
  • Isnt that just copying over a bunch of views into 1 nib file? I wanted to keep each file separated, each tab would have its on nib. Is this not possible?
    – Charles
    Jul 29, 2009 at 18:25
  • I did that and I get the same error! It seems it doesnt like the fact that Files Owners view isnt connected to anything
    – Charles
    Jul 29, 2009 at 18:27
  • I think that just puts references into the MainMenu.xib, so if you update the other files it will update the views in your application.
    – Amok
    Jul 29, 2009 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.