Xcode自定义segue - 封面垂直对面(从上到下) - COMPLETE NEWBIE

Bro*_*Eye 8 xcode segue

我已经尝试了一段时间来创建一个与封面垂直相反的自定义segue(创建一个从上到下的效果动画).我查看了其他问题,google和youtube但是无法让它工作.我是这是一个全新的课程等,所以任何步骤指南或视频的帮助都会很好.我相信这个URL正在尝试做类似于我想要的事情:

http://jrwren.wrenfam.com/blog/2012/02/01/storyboard-custom-segue-for-custom-pushviewcontroller-animation/,我无法让它发挥作用.

如果你们中的任何人都知道如何创建一个segue的顶部到底部版本的segue你可以帮助我吗?

dma*_*n82 8

好吧,你想要创建一个UIStoryBoardSegue的子类,就像演练向你展示的那样,但是在Storyboard类'.m文件(实现)中你需要以下代码作为你的 - (void)perform:方法 -

-(void)perform{
UIViewController *sourceViewController = (UIViewController *) self.sourceViewController;
UIViewController *destinationViewController = (UIViewController *) self.destinationViewController;
[sourceViewController.view addSubview:destinationViewController.view];
[destinationViewController.view setFrame:sourceViewController.view.window.frame];
[destinationViewController.view setTransform:CGAffineTransformMakeTranslation(0, -sourceViewController.view.frame.size.height)];
[destinationViewController.view setAlpha:1.0];

[UIView animateWithDuration:0.75
                      delay:0.0
                    options:UIViewAnimationOptionTransitionFlipFromTop
                 animations:^{
                     [destinationViewController.view setTransform:CGAffineTransformMakeTranslation(0, 0)];
                     [destinationViewController.view setAlpha:1.0];
                 }
                 completion:^(BOOL finished){
                     [destinationViewController.view removeFromSuperview];
                     [sourceViewController presentViewController:destinationViewController animated:NO completion:nil];
                 }];}
Run Code Online (Sandbox Code Playgroud)

希望这很有帮助.