更新时间:2021-12-17 22:21:21
讨论后发现的问题是标签栏控制器的子项嵌入在导航控制器中,所以代码需要更改为,
The problem, as discovered after a discussion, was that the tab bar controller's children were embedded in navigation controllers, so the code needed to be changed to this,
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let barViewControllers = segue.destinationViewController as! UITabBarController
let nav = barViewControllers.viewControllers![2] as! UINavigationController
let destinationViewController = nav.topviewcontroller as ProfileController
destinationViewController.firstName = self.firstName
destinationViewController.lastName = self.lastName
}