用故事板反转自定义塞

我有一个自定义的segueanimation,当推新视图控制器到堆栈时发生。 然而,当popup呈现所述自定义轮播的视图控制器时,默认导航控制器animation发生(即,当父视图控制器从左边缘在屏幕上翻译时,当前视图控制器向右移动)。

所以我的问题是这样的:有没有办法写一个自定义stream行音乐播放animation时,popup一个视图控制器的堆栈?

编辑(解决scheme):

我最终定义了一个类似于所选答案的自定义search。 在Storyboard中,我将一个自定义的Segue从子视图控制器拖回到它的父对象,给它一个标识符,并将新创build的reverse segue作为它的类。 是的,我意识到它几乎与模式转换相同。 客户的要求使这种疯狂成为必然,所以在有人提出意见之前,要明白我知道在正常情况下不应该这样做。

- (void)perform { UIViewController *src = (UIViewController *)self.sourceViewController; UIViewController *dest = (UIViewController *)self.destinationViewController; [UIView animateWithDuration:0.3 animations:^{ CGRect f = src.view.frame; f.origin.y = f.size.height; src.view.frame = f; } completion:^(BOOL finished){ src.view.alpha = 0; [src.navigationController popViewControllerAnimated:NO]; }]; } 

是。 这里是我popup到顶层的一个例子。 当你在Storyboard中创buildsegue时。 使用select或在属性检查器中input新的新的segue类。

 // // FlipTopPop.h #import <UIKit/UIKit.h> @interface FlipTopPopToRoot : UIStoryboardSegue @end 

 // FlipTopPop.m #import "FlipTopPopToRoot.h" @implementation FlipTopPopToRoot - (void) perform { UIViewController *src = (UIViewController *) self.sourceViewController; [UIView transitionWithView:src.navigationController.view duration:0.5 options:UIViewAnimationOptionTransitionFlipFromBottom animations:^{ [src.navigationController popToViewController:[src.navigationController.viewControllers objectAtIndex:0] animated:NO];; } completion:NULL]; } @end 

如果你想popup一个级别的改变使用这个自定义的继续:

 // PopSegue.h #import <UIKit/UIKit.h> @interface PopSegue : UIStoryboardSegue @end 

 // PopSegue.m #import "PopSegue.h" @implementation PopSegue - (void) perform { UIViewController *src = (UIViewController *) self.sourceViewController; [src.navigationController popViewControllerAnimated:YES]; } 

@结束

对于现在的任何人来说,iOS 7可以让你animation两种方式:

将segue设置为Push,然后查看下面的代码以获取推送实现。

https://github.com/Dzamir/OldStyleNavigationControllerAnimatedTransition

正如评论员Linus指出的,其他解决scheme将创buildUIViewController的另一个实例。 我想这个链接在这里描述了其他替代scheme,以启用反向赛格animation。

http://robsprogramknowledge.blogspot.com/2012/05/back-segues.html