Game Development Reference
At this point, you may be wondering how you could add a view that was designed with
Apple's Interface Builder. Let's tackle this now. Code-wise, it's surprisingly simple,
and you can look it up in the CocosWithCocoa02 project if you want.
The first order of business is to create an Interface Builder resource file. In Xcode 4,
you create it comfortably from within the project using the File
command from the menu or right-click a group and select New File.
You'll be prompted to choose a template from the file template dialog. As you can see
in Figure 15-4 , you should create the Interface Builder file using the UIViewCon-
troller subclass template. This will also create the Interface Builder nib file for you
and connect it with your view controller, which is essential for the view to work.
Figure 15-4 . Create an Interface Builder view by creating a UIViewController subclass
Make sure the check box With XIB for user interface in Figure 15-5 is checked, and
make sure the Subclass of text is the UIViewController . I decided to save this
template using the filename MyView.m . You should end up with three new files in
your project: MyView.h , MyView.m , and MyView.xib .