Re: How to scroll images with NSImageView
Re: How to scroll images with NSImageView
- Subject: Re: How to scroll images with NSImageView
- From: Graham Cox <email@hidden>
- Date: Wed, 14 Jul 2010 09:26:34 +1000
On 13/07/2010, at 9:43 PM, Vincenzo Morgante wrote:
> Hi,I'm a newbie and I should create a window with an image ("resource.png") from resource folder of my XCode project. I realized that I should use NSImageView and embed it in a scroll view, but the image is not entirely showed because too large: why are the scrollers not shown?
NSImageView is not for this - it is used to display icons and so on where the image is scaled to fit the view, the view does not expand to fit the image.
You can accomplish this easily in a few lines of code with a subclass of NSView. Set the size of the view to the image size and draw the image in -drawRect:, if you put it in a scrollview it will scroll as you expect.
--Graham
_______________________________________________
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