【问题标题】:iOS disable push segue animationiOS禁用推送segue动画
【发布时间】:2015-11-04 15:24:48
【问题描述】:

我有一个故事板,其中包含用于在 NavigationController 中推送 ViewController 的各种 segue。

在情节提要中我禁用了动画:

但是,推送仍然是动画。为什么?

【问题讨论】:

    标签: ios swift navigationcontroller


    【解决方案1】:

    该动画是默认行为。您需要像这样创建自定义 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 的类更改为您刚刚创建的类,然后在种类下拉菜单中选择“自定义”。

    【讨论】:

      猜你喜欢
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-15
      • 2020-06-07
      • 1970-01-01
      • 2012-11-24
      相关资源
      最近更新 更多