SWIFT 2.2警告:试图在视图不在窗口层次结构中的SignInViewController上显示TabBar控制器



我有一个SignInVC,一个转换到TabbarVC的按钮,而不是用于使用自定义转换的segue。尽管它运行良好,但当我按下调试区域中的登录按钮时,会弹出一个错误。

在SignInVC 中

     @IBAction func onTapButton(sender: AnyObject) {
    btnFromNib.animate(1, completion: { () -> () in
        let myTabbarController = self.storyboard?.instantiateViewControllerWithIdentifier("myTabbarController") as! UITabBarController
        let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
        appDelegate.window?.rootViewController = myTabbarController
        myTabbarController.transitioningDelegate = self
        self.presentViewController(myTabbarController, animated: true, completion: nil)
    })
}

我做错了什么。。。

提前感谢

由于您正在更改rootViewController,因此不需要显示它。因此删除这行

   self.presentViewController(myTabbarController, animated: true, completion: nil)

相关内容

  • 没有找到相关文章

最新更新