NSScrollView
In the art world, a larger work is typically more expensive than a smaller 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 17.12).
Figure 17.12 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 and will be displayed in the content view, which is an instance of NSClipView.
Although this change looks tricky, it is very simple to make. In fact, it requires no code at all. Open MainMenu.nib in Interface Builder. Select the view, and choose Embed Objects in Scroll View from the Layout menu (Figure 17.13).
Figure 17.13 Embed the StretchView in a Scroll View
As the window resizes, you want the scroll view to resize, but you do not want your document to resize. Open the Size Inspector, select Scroll View, and set the Size Inspector so that it resizes with the window (Figure 17.14).
Figure 17.14 Make Scroll View Resize with Window
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 inspector change to Stretch View Size. Make the view about twice as wide and twice as tall as the scroll view. Set the Size Inspector so that the view will stick to the lower-left corner of its superview and not resize (Figure 17.15). Build the application and run it.
Figure 17.15 Make StretchView Larger and Nonresizing