我假设你想要实现的是将数据从一个标签传递到另一个标签。
“现在,我怎样才能返回到第一标签页用赛格瑞?因为我需要传递,以做一个查询到数据库的参数。”
其实,你不“T必须执行SEGUE来传递数据,而不是你能做到以下几点:
// somewhere in your code when you need to pass data to another tab viewController:
if let tabBarController = tabBarController {
let secondTabViewController = tabBarController.viewControllers![1] as! SecondViewController
// let's assume that you want to pass a string
secondTabViewController.str = "my str!!"
}
SecondViewController:
class SecondViewController: UIViewController {
// here is the string that had been passed from the first tab viewController:
var str:String?
override func viewDidLoad() {
super.viewDidLoad()
// note that the output is: "Optional("my str!!")"
print(str)
// do optional binding:
if let unwrappedStr = str {
// output is: "my str!!"
print(unwrappedStr)
}
}
}
我希望它有帮助。
你需要使用一个unwind segue回去 – Paulw11