如何从左/右到左移动模态下的ViewController

时间:2016-02-27 12:08:51

标签: ios objective-c

在objective-C中,我想从左/右到右移动到模态上的下一个ViewController。 (不要使用推送)

如何从左/右到左/右对模态进行屏幕转换?

1 个答案:

答案 0 :(得分:0)

你可以做到 首先,您需要导入

#import <QuartzCore/QuartzCore.h>

之后

 NextViewController *nextVC = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil]];
 CATransition *animation = [CATransition animation];
 [animation setDuration:0.5];
 [animation setType:kCATransitionPush];
 [animation setSubtype:kCATransitionFromLeft];
 [[nextVC.view layer] addAnimation:animation forKey:@"MoveNextView"];
 [self presentViewController:nextVC animated:NO completion:nil];