gpt4 book ai didi

ios - 呈现弹出窗口

转载 作者:行者123 更新时间:2023-11-30 13:49:27 26 4
gpt4 key购买 nike

所以我目前有一个弹出窗口,当用户按下按钮时会呈现给用户。我遇到的问题是,我似乎无法关闭此 View Controller ,然后呈现按下按钮时应出现的 View Controller 。

是否有办法关闭 View Controller ,但仍然显示另一个 View Controller ,这是我下面的代码?

@IBAction func unlockButtonDidTouch(sender: AnyObject) {

dismissViewControllerAnimated(true) {() -> Void in
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("unlockVC") as! UnlockViewController
self.presentViewController(vc, animated: true, completion: nil)
}
}

这是我按下按钮后出现的错误。

2015-12-25 19:34:40.008 Corral[771:165154]警告:尝试呈现不在窗口层次结构中的 View !

最佳答案

您不能在完成 block 内调用self.presentViewController(vc,animated: true,completion: nil)。因为您的 contentViewController 已被解雇。这意味着此时 selfnil。因此,您应该从另一个呈现您的 UIPopoverController 的 View Controller 来执行此任务。

关于ios - 呈现弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34475907/

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