iOS禁用推送转场动画。

5

我有一个包含不同分支的Storyboard,用于在NavigationController中推送ViewControllers。

在Storyboard中,我禁用了动画:

enter image description here

然而,推送仍然带有动画效果。为什么会这样呢?

1个回答

4
那个动画是默认行为。您需要创建一个自定义的UIStoryBoardSegue,像这样:
PushNoAnimationSegue.h文件如下:
#import <UIKit/UIKit.h>

@interface PushNoAnimationSegue : UIStoryboardSegue

@end

PushNoAnimationSegue.m是:

#import "PushNoAnimationSegue.h"

@implementation PushNoAnimationSegue

-(void) perform{
    [[[self sourceViewController] navigationController] pushViewController:[self   destinationViewController] animated:NO];
}

@end

对于每个segue,现在将类更改为你刚创建的这一个,并在种类下拉菜单中选择“自定义”。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接