R – How does Interface Builder know about UIViewController’s view

cocoa-touchinterface-builderiphoneuiviewuiviewcontroller

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?

Best Answer

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.