【问题标题】:How to show segue from bottom of the screen如何从屏幕底部显示 segue
【发布时间】:2016-06-02 13:29:36
【问题描述】:

我在两个控制器(A,B)之间创建了一个转场。在控制器 A 中,我使用“performSegueWithIdentifier”方法来显示控制器 B 的视图。但是,我想在呈现 B 时添加一个动画。我希望它从屏幕底部显示/隐藏。我该怎么做?

【问题讨论】:

  • 是什么样的segue?推送/展示,还是呈现/模态?
  • 使用 UIViewControllerAnimatedTransitioning 简单地做一个自定义的演示过渡动画。

标签: ios swift animation


【解决方案1】:

当我在 Attributes Inspector 中选择类型的 segue 时,我使用 Present As Popover 实现了这一点。确保将锚点指向要从中进行切换的视图控制器,this 答案非常有帮助。

确保给它一个标识符(使用下面的这个标识符),并在您希望执行 segue 时使用典型的 perform segue 代码:

dispatch_async(dispatch_get_main_queue()) { 
    [unowned self] in
        self.performSegueWithIdentifier("Identifier", sender: self)
}

确保将“标识符”字符串替换为您自己的 segue 标识符字符串。

【讨论】:

    猜你喜欢
    • 2014-09-29
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多