Re: Create resizing Views
Re: Create resizing Views
- Subject: Re: Create resizing Views
- From: Shawn Erickson <email@hidden>
- Date: Wed, 28 Jan 2004 09:14:49 -0800
On Jan 28, 2004, at 8:19 AM, email@hidden wrote:
How can I create Resizing Views?
Like iTunes (Source, album image) that can resize the various parts?
Umm... basically the view system in Cocoa already supports this
capability. Just read some of the documentation on it.
<
http://developer.apple.com/documentation/Cocoa/Conceptual/DrawViews/
index.html>
Also Interface Build has great support for this via the springs/struts
configuration widget on the found on the "Size" panel on the object
inspector (Info panel).
<
http://developer.apple.com/documentation/DeveloperTools/Conceptual/
IBTips/IBTips.html>
From the IB FAQ...
How do I set up the springs and struts so my views autosize?
Views can be made to resize automatically when the window or split view
that contains them is resized. You will probably need to set the
springs and struts for every view in your window. The easiest way to
see how they work is to assign a few views with different settings and
then use File > Test Interface to see the results. To see how this
works, bring up the Size info panel and select a square bevel button.
There are two parts to Cocoas auto sizing: growing and anchoring. How
the button grows is determined by the strut/spring setting shown inside
the button picture in the info panel. If an axis (horizontal or
vertical) is a spring, then the view can grow when its container is
resized. If its not a spring, but rather a strut, the button will
remain the same size. Click on the horizontal axis inside the mock
button to turn it into a curly spring. Then use the menu item File >
Test Interface to test the interface. Grow the window in various
directions. The button gets longer, but never taller or shorter. Click
the switch icon in the menu bar or press Command-Q to stop testing the
interface. Repeat this process, but with the vertical axis set as a
spring. Now it can get taller or shorter but never wider. The outer set
of springs and struts represents how the view is to be anchored. If a
segment is a strut, the view maintains a constant distance to the side
of its container along that side. However, if its a spring the view
allows the distance to vary. Select the sample square bevel button and
click the left-most segment so that it turns into a spring. Because the
segment at right is still a strut, the view maintains a constant
distance to the edge of the window from the views right side, but
allows a variable distance along the left side. Test the interface to
see the effect.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.