In the world of art, a larger work is typically more expensive than a small one of equal quality. Your beautiful view is lovely, but it would be more valuable if it were larger. How can it be larger yet still fit inside that tiny window? You are going to put it in a scroll view (Figure 12.15).
Figure 12.15 Completed Application
A scroll view has three parts: the document view, the content view, and the scroll bars. In this example, your view will become the document view. It will be displayed in the content view, which is an instance of NSClipView.
It looks tricky, but it is actually very simple to do. In fact, it requires no code at all. Open up MainMenu.nib in Interface Builder. Select the view, and choose Group In Scroll View from the Layout menu (Figure 12.16).
Figure 12.16 Group StretchView in ScrollView
As the window resizes, you want the scroll view to resize, but you do not want your document to resize. So open the Info Panel, select the scroll view, and set the size inspector so that it resizes (Figure 12.17).
Figure 12.17 Make ScrollView Resize With Window
Also, note the width and height of the view.
To select the document view, double-click inside the scroll view. You should see the title of the Info Panel change to StretchView (Custom) Info. Make the view about twice as wide and twice as tall as the scroll view. Set the size inspector so that the view will not resize (Figure 12.18). Build it and run it.
Figure 12.18 Make StretchView Larger and Non-resizing