我试图使用已在应用中处于活动状态的视图控制器,我正在做这样的事情:
if TabBar == nil {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
TabBar = storyboard.instantiateViewControllerWithIdentifier("TabBar") as! UITabBarController
self.presentViewController(TabBar!, animated: true, completion: nil)
}
else
{
self.presentViewController(TabBar!, animated: true, completion: nil)
}
" TabBar"视图控制器我有相同的方法
if(Queue == nil)
{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
Queue = storyboard.instantiateViewControllerWithIdentifier("Queue") as! UITableViewController
self.presentViewController(Queue, animated: true, completion: nil)
}
else
{
self.presentViewController(Queue!, animated: true, completion: nil)
}
这里的一切都很好,但当我再次去" TabBar"时,我收到了错误
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller
我知道我无法以模态方式呈现一个活跃的控制器,但我不知道如何使其显而易见。 "的TabBar"再次查看控制器,任何想法?感谢