Re: Dumb question: How does NSScrollView know the size of the thing it's scrolling?
Re: Dumb question: How does NSScrollView know the size of the thing it's scrolling?
- Subject: Re: Dumb question: How does NSScrollView know the size of the thing it's scrolling?
- From: Graham Cox <email@hidden>
- Date: Thu, 24 Jul 2008 11:39:27 +1000
For zooming, check out NSView's -scaleUnitSquareToSize: which changes
the scale factor of the view's transform. Together with -setFrame: (or
-setFrameSize:) you can implement arbitrary zooming. If the view is
enclosed by a scroller, it will adjust the scrollbars automatically,
as well as any rulers that are shown.
You could also use this simple NSView subclass that gives you
straightforward high-level action methods for zooming:
http://apptree.net/gczoomview.htm
Though since writing that as a subclass of NSView I have discovered
you can do the same using a NSView category - it's not necessary to
store the scale factor as a data member (as I do here) but just work
it out on the fly from other NSView values.
hth,
Graham
On 24 Jul 2008, at 5:20 am, Rick Mann wrote:
Thanks to everyone for their informative answers. I gotta say, I
think the docs are a bit lacking, but maybe I just had certain
assumptions going in (that a subview's frame should be contained
within a superview's bounds, etc.)
--
Rick
_______________________________________________
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