ios - Loaded nib but the 'view' outlet was not set

ID : 2187

viewed : 187

Tags : ioscocoa-touchinterface-builderxibios





Top 5 Answer for ios - Loaded nib but the 'view' outlet was not set

vote vote

100

Here's what worked for me:

  • Open the XIB file causing problems
  • Click on file's owner icon on the left bar (top one, looks like a yellow outlined box)
  • If you don't see the right-hand sidebar, click on the third icon above "view" in your toolbar. This will show the right-hand sidebar
  • In the right-hand sidebar, click on the fourth tab--the one that looks a bit like a newspaper
  • Under "Custom Class" at the top, make sure Class is the name of the ViewController that should correspond to this view. If not, enter it
  • In the right-hand sidebar, click on the last tab--the one that looks like a circle with an arrow in it
  • You should see "outlets" with "view" under it. Drag the circle next to it over to the "view" icon on the left bar (bottom one, looks like a white square with a thick gray outline
  • Save the xib and re-run
vote vote

89

This is Josh Justice proposal, but in a graphical way (pictures are mine):

  1. Select File owner
  2. On right hand side panel select custom class.
  3. Enter the custom class name

enter image description here

  1. On right hand side panel select oultets
  2. Drag view outlet to view component

enter image description here

Finally the View Controller is instantiated with the rolling code:

        PTFilterUserVC *aFilterUserVC = [[PTFilterUserVC alloc] initWithNibName:@"FilterVC" bundle:nil];          //OPTIONAL.This is how 'I' am interested in present the view controller.         [self.navigationController pushViewController:aFilterUserVC animated:YES]; 
vote vote

76

I can generally fix it by remaking the connection between File's Owner and the view. Control-drag from the File's owner to your View (in IB) and select view from the pop-up menu.

vote vote

62

The View Identity - Class Identity was not set. After setting it to the appropriate class, the issue was resolved.

vote vote

52

Are you sure you have a UIView (or subclass) assigned to the "view" property of yourViewController?

Right click on "File Owner" in the left pane of the xib for yourViewController and verify that the "view" outlet is set. If not, set it to a view!

this will definetly fix the Issue

Top 3 video Explaining ios - Loaded nib but the 'view' outlet was not set







Related QUESTION?