Loaded Some NIB but the view outlet was not set

Source: Internet
Author: User

This problem occurs when the initwithnibname function is used and the view attribute of viewcontroller generated by the NIB file is used.

// Load LOC. XIB

Uiviewcontroller * uivc = [[uiviewcontroller alloc] initwithnibname: @ "Loc" Bundle: Nil];

[Self. View addsubview: uivc. View];

[Uivc release];

Nibname [220:207] *** terminating app due to uncaught exception 'nsinternalinconsistencyexception', reason: '-[uiviewcontroller _ loadviewfromnibnamed: Bundle:] loaded the "Loc" nib but the view outlet was not set.'

It indicates the NIB file we loaded. The "View" attribute value is not set.

The actual situation here: not the generated VC's view property value is nil, but the generated VC does not have the view property. We use the VC defined by uiviewcontroller. Why does VC (View Controller) have no view attribute?

(What a logical expression is not as good as a successful complete operation, begin :)

Solution:

1. Click the XIB file we want to load.

 

2. Select File's owner on the right.

 

3. In the "Custom class" attribute settings on the tab of the file's owner, change the class value to the corresponding VC, and change it to uiviewcontroller,

4. In this case, the view attribute "pending connection settings" will appear on the file's owner tab, which is what our compiler tells usThe view outlet was not set. When the class of the file's owner is nsobject, there is no view attribute.

 

Connection view property,

5. Win + R, OK.

Shi
Source: http://www.cnblogs.com/TivonStone/
I hope this article will be helpful to you. If you want to turn it around, leave a link for my article. O (...) O


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.