views:

4254

answers:

4

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!

A: 

did you try bluid clean all targets

ennuikiller
For the last 10 hours!!!!!!!!
A: 

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.

Amuck
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?
I did that and I get the same error! It seems it doesnt like the fact that Files Owners view isnt connected to anything
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.
Amuck
A: 

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!

+3  A: 

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.

martin jakubik