Re: NSView unit scale question ?
Re: NSView unit scale question ?
- Subject: Re: NSView unit scale question ?
- From: "John C. Randolph" <email@hidden>
- Date: Sat, 19 Feb 2005 18:28:24 -0800
On Feb 18, 2005, at 7:03 AM, Robert Miller wrote:
Hello,
Has anyone had in depth experience with the
'scaleUnitSquareToSize' call vs. the resulting frame size of the
receiver ? I'm working on an application that has movable / resizable
custom subviews that are also scalable. I've done some research and
have discovered some very useful examples on scaling using the
scaleUnitSquareToSize' call and understand it's use and how the
bounds rectangle of a view is affected by this call. The call does
not affect the frame rectangle as would be expected however, I want
to be able to display the entire scaled bounds in the NSView after
scaling.
The frame of a view is the view's location and size in its superview's
coordinate space. -scaleUnitSquareToSize: affects the bounds, not the
frame of a view.
I've added some code which effectively readjusts the frame rectangle
to do this. The real issue is that once a view is scaled it seems
that any subviews within that view seem to have lost their auto
resize mask. (even though diagnosis has shown that they haven't) The
behavior of subviews when a previously scaled view is subsequently
resized appears as if they have. Example. A custom view is created
and displayed, the custom view contains sub views whose 'spring'
settings include NSViewMinYMargin and NSViewMaxXMargin which cause
the subviews to 'stick' to the top left corner of the view when the
view is resized such that its width and height are increased. After
the view is scaled the subviews no longer behave as if the previously
mentioned resize settings are in effect. (even though as previously
stated the values for resizing have not changed). In other words when
the view is resized after a scale is applied the subviews now move
and no longer stick to the top left corner. Is this some strange
anomaly with scaling and resizing mask behaviors internal to NSView.
Does my example make sense ?
The resizing behavior pertains to the frame, and not the bounds. Once
you've scaled the bounds, if the frame changes, the view may appear to
move in unexpected ways depending on the view's own coordinate space
(it may be inverted, for example).
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden