[英]Swift- Segue to UITabBarController page from ViewController
我的应用程序中有一个UITabViewController
。 在UITabViewController
的第三个ViewController
上,用户可以转到UITabViewController
之外的单独的ViewController
。 但是,当他们回头看时,不会显示UITabView
条。 因此,我对UITabViewController
进行了UITabViewController
但现在它只转到UITabViewController
的第一页,而不是第三页。 我在单独的ViewController
文件上有一个prepareForSegue(),告诉它转到第3页,但它似乎不起作用。 这是我的代码:
func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "tabBarShow"){
if let tabVC = segue.destination as? UITabBarController {
tabVC.selectedIndex = 2
let tabBarController = storyboard?.instantiateViewController(withIdentifier: "TabBarController") as! UITabBarController
tabBarController.selectedViewController = tabBarController.viewControllers![2]
}
}
}
有谁知道如何解决这个问题? 任何帮助将不胜感激。 提前非常感谢!
干杯,西奥
你有没有尝试过:
@IBAction func backTouched(sender: AnyObject) {
dismissViewControllerAnimated(true, completion: nil)
}
将其链接到您要关闭的控制器中? 还是使用func unWindToSegue(segue:...)方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.