简体   繁体   English

iOS禁用push segue动画

[英]iOS disable push segue animation

I have a storyboard with various segues for pushing ViewControllers in a NavigationController. 我有一个带有各种segue的故事板,用于在NavigationController中推送ViewControllers。

In storyboard i disabled Animation: 在故事板我禁用动画:

在此输入图像描述

However the push is still animating. 然而,推动仍然是动画。 Why? 为什么?

That animation is the default behaviour. 该动画是默认行为。 You need to create a custom UIStoryBoardSegue like so: 你需要像这样创建一个自定义的UIStoryBoardSegue:

PushNoAnimationSegue.h is: PushNoAnimationSegue.h是:

#import <UIKit/UIKit.h>

@interface PushNoAnimationSegue : UIStoryboardSegue

@end

PushNoAnimationSegue.m is: PushNoAnimationSegue.m是:

#import "PushNoAnimationSegue.h"

@implementation PushNoAnimationSegue

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

@end

For each segue now change the class to this one you just created and choose "custom" in the kind drop down menu. 现在,对于每个segue,将类更改为刚刚创建的类,并在类型下拉菜单中选择“自定义”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM