呈现navigationController时出错

时间:2015-11-10 14:18:07

标签: ios swift uinavigationcontroller

我正在尝试提供一个navigationController,它似乎可以工作并呈现navigationController。但是,即使它有效,我仍然会收到错误吗?

我的代码

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!

1 个答案:

答案 0 :(得分:0)

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