On Aug 19, 2010, at 11:12, Brian Postow wrote:

> Ok, the NSScrollView came with an NSView in it. I changed that to NSClipView, 
> and added an NSImageView in the clipview.

Er, no. The NSScrollView came with a NSClipView and a NSView, but IB helpfully 
hides the NSClipView. So you don't need to add one -- just change the NSView to 
an NSImageView and you're done.

> How big do I make the imageview? Currently, it's the same size as the 
> clipview. 

It doesn't matter what you do in IB, because you're going to have to do 
something else programmatically later. You basically have 2 modes: zoom to fit, 
and zoom to scale factor, and there's a difference image view size calculation 
for each so it must be done manually. Consequently, you probably want to 
prevent (in IB) the image view from autoresizing.

> The way I'm testing is by zooming in on the image with: [imageView 
> scaleUnitSquareToSize: NSMakeSize(zoomFactor, zoomFactor)]
> 
> 
> Also When I do zoom to fit with       [imageView setImageScaling: 
> NSScaleToFit]; it zooms BOTH dimensions. Normally you want to zoom to the 
> smaller dimension, but keeping the same aspect ratio. is there an easy way to 
> do this?

Well, you want NSScaleProportionally instead of NSScaleToFit, except that both 
are deprecated in 10.6, so you *really* want NSImageScaleProportionallyUpOrDown.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to