Xcode Segue View Controller从右到左没有UINavigation

时间:2016-02-06 01:21:56

标签: ios segue xcode7

我希望将我的View Controller从右向左转换(就像导航控制器做IT一样)但是没有嵌入UINavigationController。我使用的是Xcode 7,标准的Segue似乎没有这个选项。非常欢迎任何指导!

1 个答案:

答案 0 :(得分:2)

如果你想成为一名黑客,你可以这样做:

CATransition *transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.window.layer addAnimation:transition forKey:nil];

[self presentModalViewController:viewCtrl animated:NO];

您应该只使用导航控制器或编写自定义过渡动画,请参阅here以获取您想要的动画项目。

let transition = CATransition()
transition.duration = 0.3
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight

self.view.window?.layer.addAnimation(transition,forKey:nil)
self.presentViewController(viewCtrl, animated: false, completion: nil)

如果你需要在Swift中使用它。