Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Another simple problem...

Another simple problem...
Thread Tools
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Murray, Utah, USA
Status: Offline
Reply With Quote
May 22, 2001, 01:34 PM
 
Probably extremely simple, but I've tried I think every combination I can think of -- how do I link a view to the window, so that when the window is resized the view grows/shrinks as well?

I know it is done in IB with the Size info panel and the "springs" and straight lines... just can't figure it out.

For simplicity, if someone could just give an example (simple steps) of making a view that takes up the entire window "real estate" and grows with it that'd be great!

Thanks again, everyone!
Jeff
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
May 22, 2001, 03:39 PM
 
Here is my understanding of how the size inspector works: straight lines indicate fixed values and springs represent values that can grow/shrink. Now think about what happens when you grow the window.
Code:
Coordinates of view before resize: (10,10)-----(20,10) width=10 height=20 (10,30)-----(20,30) after resize: (10,10)------------(25,10) width=15 height=25 (10,35)------------(25,35)
What values stay the same? The top and left coordinates. What values change? The width and height, and the bottom and right coordinates. Therefore to get this behavior in IB, you want straight lines for the top and left, springs for width and height (inside the box), and springs for the bottom and right.

Like this:
Code:
| _|_ | 3 | --|m+m|mm |_3_| 3 3
I don't have access to IB at the moment, but I think this is correct. Please excuse my horrible ascii art.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
May 23, 2001, 01:25 PM
 
The interior springs indicate that the view itself will resize in that dimension if the window (well, superview really) resizes. The four settings on the outside indicate whether that edge of the view should "stick" to that side of the window when things are resized -- i.e. remain a constant distance from that window edge (or superview edge, if it's a subview of another one).

For a view that takes up the entire window, both interior settings should be springs, and the four outside settings should be struts (lines).

For a button in the bottom left that should remain in the bottom left, the interior settings should be struts (since the button itself should never resize), the bottom and left outside edges should be struts, and the top and right outside edges should be springs.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2