简体   繁体   中英

iOS disable push segue animation

I have a storyboard with various segues for pushing ViewControllers in a NavigationController.

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:

PushNoAnimationSegue.h is:

#import <UIKit/UIKit.h>

@interface PushNoAnimationSegue : UIStoryboardSegue

@end

PushNoAnimationSegue.m is:

#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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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