Re: Controls disappearing from window during resize
Re: Controls disappearing from window during resize
- Subject: Re: Controls disappearing from window during resize
- From: Andy Lee <email@hidden>
- Date: Thu, 23 Oct 2008 13:46:02 -0400
On Oct 23, 2008, at 12:30 PM, Eric Gorr wrote:
On Oct 23, 2008, at 11:35 AM, Andy Lee wrote:
You have the text field set to grow and shrink in proportion to its
superview. In the Size inspector, note the red double-ended
horizontal arrow inside the box. In the parlance of struts and
springs, that is a "spring." Click that spring to turn it off, and
also turn off the strut on the right side outside the box. In
other words, only have two struts turned on: the ones on the top
and left.
Please try this yourself and then shrink the window to it's smallest
height. The 'Label' text will disappear.
You are right -- I only noticed a problem with the width, but I see
that is not what you are asking about, since the text view does
reappear if you only resize horizontally.
The reason the label disappears is that when you make the window
small, the text field's width scales to zero. When you expand the
window again, IB scales the width accordingly (as you specified) --
except now it's scaling zero, which always returns zero.
The problem occurs not when I change the width of the window. The
problem occurs when I change the height.
The same reasoning applies except in the other dimension. One or more
vertical distances are getting scaled to zero, and this produces
undesired results. If you change the height gradually up and down you
will see the text field get shoved up and out of view. The solution
is to either impose a minimum size on your window or implement your
own autoresizing as Cathy Shive did.
Related problems have been reported before, for example with the
subviews of split views. Bottom line: if at all possible prevent any
of the relevant measurements (width, height, margins) from scaling to
zero. In addition, for each direction I personally try to have two of
the three measurements be fixed, to avoid tiny errors that I'm
guessing are caused by roundoff when two or three of the measurements
are "springy." When two of the three measurements are fixed, IB only
has to do subtraction to compute the third -- no division.
I suspect your particular problem occurs vertically and not
horizontally because of the coordinate system. Shrinking the window
increases the y of the bottom edge but decreases the x of the right
edge. This is just a guess as to why the behavior is not symmetric.
I would call it an annoyance rather than a bug, but either way, it
should be fine to submit a Radar.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden