0

介绍时:

CATransition *animation=[CATransition animation];
animation.delegate=self;
animation.duration=0.3;
animation.type=kCATransitionMoveIn;
animation.subtype=kCATransitionFromRight;

UIViewController13 *vc = [[UIViewController13 alloc] init];
[self presentViewController:vc animated:NO completion:nil];
[vc.view.layer addAnimation:animation forKey:@"animation"];

但我不知道如何自定义关闭动画

4

1 回答 1

-1

尝试这样做:

CATransition *animation=[CATransition animation];
animation.delegate=self;
animation.duration=0.3;
animation.type=kCATransitionMoveIn;
animation.subtype=kCATransitionFromRight;

UIViewController13 *vc = [[UIViewController13 alloc] init];

[self presentViewController:vc animated:NO completion:nil];
[self.view insertSubview:vc.view atIndex:0];  //line we add
[self.view.layer addAnimation:animation forKey:@"animation"]; //we edit
于 2013-08-19T09:05:09.170 回答