I want to create transition between view controllers like this. https://www.dropbox.com/s/qatwqaq2mowocsg/Transitions%20Controller.gif?dl=0
I 've used the following code to create transition but cannot achieve following results.
self.settings = [self.storyboard instantiateViewControllerWithIdentifier:@"settings"];
CATransition* transition = [CATransition animation];
transition.duration = 0.4;
transition.type = kCATransitionPush;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
transition.subtype=kCATransitionFromRight;
[[self navigationController].view.layer addAnimation:transition forKey:kCATransition];
[[self navigationController] pushViewController:self.settings animated:NO];
You can try this code :
self.settings = [self.storyboard instantiateViewControllerWithIdentifier:@"settings"];
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:0.80];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:
UIViewAnimationTransitionFlipFromRight
forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:self.settings animated:YES];
[UIView commitAnimations];
Start from iOS7 you can custom the transition effect of system method pushViewController and presentViewController. For example if you need to custom the push effect there is a method in UINavigationControllerDelegate
named
- (id<UIViewControllerAnimatedTransitioning> _Nullable)navigationController:(UINavigationController * _Nonnull)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController * _Nonnull)fromVC toViewController:(UIViewController * _Nonnull)toVC
add the custom animation to fromVC's view and show the toVC's view in proper time
虽然它不是代表THE ANSWER
的直接可实现的代码块,但此博客应该可以帮助您完成创建自己的自定义转换的步骤: http : //blog.dadabeatnik.com/2013/10/13/custom-segues/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.