【问题标题】:UIViewController default transition animation not workingUIViewController 默认过渡动画不起作用
【发布时间】:2017-03-23 22:14:42
【问题描述】:

我试图在 navigationController 中以模态方式呈现 viewController ,然后在 x-seconds 之后推送另一个视图,但由于某种原因,firstsecond view 没有动画呈现。我尝试在主线程上dispatch UI 相关代码,但它没有修复错误。

我使用navigationController.setViewControllers([vc]), animated: true) 首先是rootViewController.present(navigationController, animated: true),对于这两个视图,

知道为什么缺少动画吗?

【问题讨论】:

    标签: ios swift uiviewcontroller uinavigationcontroller modalviewcontroller


    【解决方案1】:

    尝试使用

    Self.layoutIfNeeded()
    

    【讨论】:

      【解决方案2】:

      present modally 时,你应该使用presentViewController 方法。 当push 变成navigationController 时,你应该使用pushViewController。 如果你想先present,说VC1 现在NC2(以VC2 为根)。那么你应该使用NC2pushViewController

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-28
        • 2012-04-18
        • 2016-09-22
        • 2018-02-28
        • 1970-01-01
        • 2019-08-15
        • 2017-06-28
        • 1970-01-01
        相关资源
        最近更新 更多