Animate magnifyToFitRect:
Animate magnifyToFitRect:
- Subject: Animate magnifyToFitRect:
- From: Leonardo <email@hidden>
- Date: Tue, 30 Apr 2013 17:09:43 +0200
- Thread-topic: Animate magnifyToFitRect:
Hi,
in my custom NSClipView class I would like to subclass the method
smartMagnifyWithEvent and zoom the rect on which the user has double tapped.
So I properly detect the rect to magnify, then I tell the scrollView to
[self.superview magnifyToFitRect:boxFrame];
and I properly get the view zoomed to the tapped area. It works.
Now I would like to animate the zoom, and as I have read on the
NSScrollView.h document, I could animate the magnifyToFitRect API using use
the object's animator.
I tried to use my traditional way (which usualy works well), unsuccessfully:
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:1.0];
[[NSAnimationContext currentContext] setCompletionHandler:^{
[self animationDidStop];
}];
[[self.superview animator] magnifyToFitRect:boxFrame];
[NSAnimationContext endGrouping];
I get the zoom without any animation. I even tried to call
[self setWantsLayer:YES];
within the init method. Then I got something moving, but the content of the
view is a mess.
The nested objects are placed here and there without a reason. Also the
document view loses its dimensions.
How can I achieve my target?
Regards
-- Leonardo
_______________________________________________
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