I'm making a navigation controller class for Mac OS X.
I want to replace the current view with a kCATransitionPush
animation.
Like in this post:
Core Animation Tutorial - Wizard Dialog With Transitions
The CATransition
is set up like this:
CATransition *transition = [CATransition animation];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view setAnimations:@{ @"subviews" : transition }];
However, when I replace the views, there is a fade animation, which is being automatically added.
[NSAnimationContext beginGrouping];
{
[[self.view animator] replaceSubview:_currentViewController.view with:newViewController.view];
}
[NSAnimationContext endGrouping];
How can I do a push animation without the fading?
The best way I've found to get smooth Core Animation transitions that works regardless of whether the view supports CA or not is to do the following:
NSView -cacheDisplayInRect:toBitmapImageRep
or a similar methodI suspect you're running into implicit animations - Core Animation will automatically animate layer property changes that happen outside of your own transactions.
There's a good summary of several methods for disabling these implicit animations in these two questions:
How to disable CALayer implicit animations?
Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]
...and you can read more about implicit transactions in the Core Animation docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With