ios - 呈现 navigationController 时出错

标签 ios swift uinavigationcontroller

我正在尝试呈现一个导航 Controller ,它似乎可以工作并呈现导航 Controller 。但是,即使它有效,我仍然不断收到错误?

我的代码

let vc = storyboard.instantiateViewControllerWithIdentifier("AdViewController") as! UINavigationController
let adController = vc.viewControllers.first as! AdViewController
adController.adObject = contentObject
self.presentViewController(vc, animated: true, completion: nil)

警告:

Warning: Attempt to present <UINavigationController: 0x1508fea00> on <Kodinh.NewsViewController: 0x1511774a0> whose view is not in the window hierarchy!

最佳答案

当您调用“self.presentViewController”时,请确保“self”可见,警告将会消失。

关于ios - 呈现 navigationController 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33632096/

相关文章:

arrays - 快速性能:map()和reduce()与for循环

ios - 使用两个不同的 XIB 查看 Controller ......棘手

ios - 如何更改 launchscreen.storyboard 中的颜色或导航栏?

swift - 如何在导航 Controller SWIFT 中呈现 View Controller

iOS 测试 : Is there a way to skip tests?

sqlite - 使用 TableView 删除表行

ios - 在这个 "starts busy"推测处理场景中使用 DispatchSemaphore

ios - 在 WatchKit 中隐藏页面指示器点?

ios - 意外删除 SWIFT_OBJC_BRIDGING_HEADER

json - 从服务器提取数据数组期间,类型 "Any"在 Swift 3 中没有下标成员