4.4. Making Windows Resizable
When designing windows, you need to consider what will happen when the user tries to resize them. For some windows, such as simple sheets and dialog boxes, you may choose to prohibit resizing. But most user-friendly interfaces allow the user to resize windows as they see fit.
An interface element normally responds in two possible ways when a window is resized. The element may remain stationary, fixed in an area of the screen, or the element may change size along with the window. Some elements may do both: remain fixed vertically and resize themselves horizontally. Interface Builder provides tools for defining what happens to its contents when a window is resized.
In the following Try It Out, you build a simple resizable Cocoa window. Figure 4-26 shows the window in two sizes. Don't worry too much about what this interface is supposed to represent; it's really just an opportunity to practice item layout.
Figure 4.26. Figure 4-26
4.4.1.
4.4.1.1. Try It Out: Building a Resizable Cocoa Window
In Interface Builder, create a new Cocoa Empty project. Your nib window appears.
Drag a Window item from the Windows palette into your nib's Instances tab. An instance named Window is added to your nib file and a blank window representing that instance appears.
Choose ToolsShow Inspector to open the Inspector. The Inspector displays the settings for the new window. ...
Get Beginning Mac OS® X Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.