gpt4 book ai didi

ios - showViewController 方法只显示模态视图

转载 作者:行者123 更新时间:2023-11-28 06:43:54 25 4
gpt4 key购买 nike

看着苹果 Resource使用 showViewController()presentViewController() 我似乎无法在这里弄清楚我的问题。

我想通过执行以下操作以编程方式显示 Storyboard中的 viewController:

  if let resultController = storyboard!.instantiateViewControllerWithIdentifier("mainTab") as? TabBarController {
showViewController(resultController, sender: UIBarButtonItem.self)
}

这很好用。但是,它的呈现始终是模态的。像这样从下到上垂直覆盖屏幕:

modal display

我曾经/现在仍然觉得我应该使用 showViewController 来显示没有动画的屏幕......但显然我在这里遗漏了一些东西。我想要做的就是以非模态方式显示 VC。我觉得我已经尝试了一切都无济于事。

提前感谢您的建议。

最佳答案

我想你想使用这样的东西。

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("Controller") as! UIViewController
self.presentViewController(vc, animated: false, completion: nil) // no animation or presentation as modal because animated is false

关键是将动画设置为false。这种方法对我有用。希望这可以帮助!

关于ios - showViewController 方法只显示模态视图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37092538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com