在swift中打开新视图时出错

时间:2015-12-21 12:42:07

标签: ios swift uiview

当我想要打开新视图并且我不知道它是什么意思时,我有这个错误。 我运行该代码:

func openMenu(){
    let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let vc: UIViewController = storyboard.instantiateViewControllerWithIdentifier("MenuViewController") as UIViewController
    self.presentViewController(vc, animated: true, completion: nil)
}

错误是:

警告:尝试显示其视图不在窗口层次结构中!

我有Swift代码:
Swift
我想用Objective-C执行Swift代码。
Objective-C

0 个答案:

没有答案