In this recipe, we will be using Interface Builder to define the size and location of our custom view. In the last recipe Drawing in your custom view, we created our view programmatically by specifying the view's frame and then adding the view to the windows content view. Using Interface Builder to define your views makes it simpler to visually lay out your interface and set various properties, such as resizing.
Rather than creating a new Xcode project for this recipe, let's duplicate the project from the last recipe Drawing in your custom view.
1. Open the file
CustomViewAppDelegate.m
by double-clicking on it.2. Remove or comment out all the code in the
applicationDidFinishLaunching:
method.3. Double-click on the
MainMenu.xib
file to open it in Interface Builder. In Interface Builder's Library palette, locate the Custom View and drag it onto the applications window.4. Select the Size tab from the Inspector pallet...