标签:
/* Common transition types. */ CA_EXTERN NSString * const kCATransitionFade __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionMoveIn __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionPush __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionReveal __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
/* Common transition subtypes. */ CA_EXTERN NSString * const kCATransitionFromRight __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionFromLeft __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionFromTop __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0); CA_EXTERN NSString * const kCATransitionFromBottom __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
/*** CATransition ***/ //CATransition - (CATransition *)transition { CATransition *transition = [CATransition animation]; transition.duration = 1; transition.type = @"cube"; transition.subtype = @"fromRight"; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; return transition; } - (void)onClick:(id)sender { ViewController2 *vc2 = [[ViewController2 alloc] init]; [self presentViewController:vc2 animated:NO completion:nil]; [self.view.window.layer addAnimation:[self transition] forKey:@"kTransitionAnimation"]; }
/*** CATransition ***/ //CATransition - (CATransition *)transition { CATransition *transition = [CATransition animation]; transition.duration = 1; transition.type = @"cube"; transition.subtype = @"fromRight"; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; return transition; } - (void)onClick:(id)sender { ViewController2 *vc2 = [[ViewController2 alloc] init]; [self.navigationController pushViewController:vc2 animated:NO]; [self.view.window.layer addAnimation:[self transition] forKey:@"kTransitionAnimation"]; // or [self.navigationController.view.layer addAnimation:[self transition] forKey:kTransitionAnimation]; }
CATransition自定义UIViewController过渡动画
标签:
原文地址:http://blog.csdn.net/nextstudio/article/details/42296559