Re: NSImageView and ZoomFactors
Re: NSImageView and ZoomFactors
- Subject: Re: NSImageView and ZoomFactors
- From: Quincey Morris <email@hidden>
- Date: Thu, 19 Aug 2010 10:45:37 -0700
On Aug 19, 2010, at 07:16, Brian Postow wrote:
> so, are you suggesting that I manually control the "zoom-to-fit" functionality, and change the size of the image as the window changes size myself so I can keep track of the "desired display scale"? or is there some other way of getting that?
The desired display scale comes directly from the relationship between the size of the content view frame and the size of the (unscaled) image. It's hard to be more specific, because it all depends on what you're trying to achieve and how you're trying to achieve it. If you're trying to use a specific scale (like 100% or 200%), then you'll size the document view based on the image size, and the content view doesn't come into the calculation. If you're trying to zoom to fit, you'll size the document view based in the content view frame. Once you've decided the document view size, you'll arrange for the image to be drawn in the document view, scaled (in any of various possible ways) to the document view size.
> So, the content view should go INSIDE the document view? I should have 3 views? a scrollview, a document view and an NSImageView?
The view hierarchy of a scroll view *is* like this:
scroll view (NSScrollView)
content view (NSClipView)
document view (whatever you want to use, possibly a NSImageView, or a custom NSView, or an entire subview hierarchy)
(plus scrollers and rulers, if used).
So it's just a matter of keeping the terminology straight. I was just pointing out the possible confusion, since it's really the document view that supplies what you'd normally think of as "contents", not the content view. Setting the document view to (say) a NSImageView is valid, but setting the content view at all is almost certainly a mistake.
_______________________________________________
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