Trying to simulate a NSScrollView within a NSView
Trying to simulate a NSScrollView within a NSView
- Subject: Trying to simulate a NSScrollView within a NSView
- From: <email@hidden>
- Date: Thu, 11 Feb 2010 17:05:46 +0100
- Acceptlanguage: en-US
- Thread-topic: Trying to simulate a NSScrollView within a NSView
Hi,
I am trying to emulate a scrolling behavior within a NSView.
I am calling scrollRect:by: and as the documentation specifies:
------------------
Discussion
This method is useful during scrolling or translation of the coordinate system to efficiently move as much of the receiver’s rendered image as possible without requiring it to be redrawn, following these steps:
• Invoke scrollRect:by: to copy the rendered image.
• Move the view object’s origin or scroll it within its superview.
• Calculate the newly exposed rectangles and invoke either setNeedsDisplay: or setNeedsDisplayInRect: to draw them.
You should rarely need to use this method, however. The scrollPoint:, scrollRectToVisible:, and autoscroll: methods automatically perform optimized scrolling.
(cf. http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html )
------------------
The scrolling (step 1) looks fine but I don't really get how to set the origin.
My goal is to only redraw the updated areas (top or bottom).
I use Quartz Debug to visualize the updated areas.
I tried using setBounds: but it redraws everything.
A small project can be found here:
http://files.me.com/ffreling/4oa6n8
(I set the NSImageView to an image from my desktop for the example, you can remove it or set it to another image if you want)
Any help would be appreciate :)
Thank you.
Best regards,
--
Fabien Freling
Software Engineer, Platform team
Nokia, Qt Development Frameworks
_______________________________________________
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