Loaded some nib but the view outlet is not set

Source: Internet
Author: User

Link Address: http://www.cnblogs.com/TivonStone/archive/2012/04/20/2460116.html

This problem is encountered when using the Initwithnibname function and using the View property of the Viewcontroller generated by the nib file.

Load Loc.xib

Uiviewcontroller * UIVC = [[Uiviewcontroller alloc] initwithnibname:@ "loc" Bundle:nil];

[Self.view AddSubview:UIVC.view];

[UIVC release];

NIBNAME[2203:207] * * * terminating app due to uncaught exception ' nsinternalinconsistencyexception ', Reason: '-[ Uiviewcontroller _loadviewfromnibnamed:bundle:] Loaded the "LOC" nib but the view outlet is not set. '

Surface meaning refers to the nib file that we loaded, and the "View" property value is not set.

The actual situation here: not the VC generated by the View property value is nil, but the resulting VC does not have view this property. We are using the VC defined by Uiviewcontroller, why does the VC (view Controller) have no view properties?

(How logical a statement is less than a successful complete operation, begin:)

Solution:

1. Click on the xib file we want to load

2. On the right, select File ' Owner

3. In the "Custom Class" property setting of the File's Owner's tab, change the value of Class to the corresponding VC, which is changed to Uiviewcontroller,

4. At this point, in the file's Owner's tab, the View property of the "To connect setting" appears, and our compiler tells us the view in the view outlet is not set. When File ' s Owner's class is NSObject, there is no view attribute.

Connect the View property,

5. Win+r, OK.

Loaded some nib but the view outlet is not set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.