2
votes

UIViewController has an ivar (and @property) called view. It is not however, an IBOutlet.

When creating a view nib in Interface Builder, you typically set File's Owner to be your UIViewController (or subclass thereof), and you wire the nib's view to File's Owner's view outlet.

How does this work if the UIViewController view member isn't an IBOutlet?

4

4 Answers

3
votes

The IBOutlet keyword is used to indicate that a property should show up in Interface Builder for classes that you write. Interface Builder internally has additional knowledge about system provided classes.

If you are working with Interface Builder on the desktop, rather than iPhone, you can write Interface Builder Plug-Ins to integrate your custom classes into the Interface Builder Library (This is not supported in Interface Builder for the iPhone). In writing a plug-in, the plug-in author provides "class description" files that declare this same actions/outlets information to Interface Builder as one achieves with the IBAction/IBOutlet keywords. You can read more about it in the Interface Builder Plug-In Programming Guide.

It works essentially the same way for system provided classes as it does for plug-ins.

2
votes

I read this article a while ago and it finally tied it all together for me. Maybe it'll help you?

0
votes

The simple answer is that Apple wrote both Interface Builder and UIViewController.

-2
votes

The view property of UIViewController is just that, a Property. The whole purpose of a UIViewController is to control a view. The view property allows you to assign that view to an UIViewController. That's the purpose of the view and that's why it shows up in IB. It's a property. Just like textLabel is a property of UILabel.