Re: Strange stretching NSView
Re: Strange stretching NSView
- Subject: Re: Strange stretching NSView
- From: Ken Tozier <email@hidden>
- Date: Thu, 1 Feb 2007 18:26:38 -0500
On Feb 1, 2007, at 5:35 PM, Murat Konar wrote:
On Feb 1, 2007, at 2:16 PM, Ken Tozier wrote:
The really bizarre thing is that the smaller I set the view
height, the bigger the vertical stretch gets even though the
containing frame size stays exactly the same. It's some stupid
math error I'm sure.
You aren't confusing the effects of -[NSView setBounds:] and -
[NSView setFrame:] somewhere are you?
For example, start with a view whose frame is {100, 100, 100, 100}.
By default, its bounds will be {0, 0, 100, 100}. If you then set
the bounds of this view to {0, 0, 100, 50}, the views contents
will appear distorted in the vertical dimension because you are
effectively applying a coordinate transformation.
From the documentation on setBounds:
"After calling [setBounds:], NSView creates an internal transform
(or appends these changes to an existing internal transform) to
convert from frame coordinates to bounds coordinates in your view.
As long as the width-to-height ratio of the two coordinate systems
remains the same, your content appears normal. If the ratios
differ, your content may appear skewed."
Bingo! I was indeed confusing the two. All better now.
Thanks Murat.
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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