我如何转至我所在的 UIViewController?
How do I segueing to the UIViewController I'm in?
我正在尝试从一个填充了对象数据的视图转到相同的视图,但通过 segue 填充了不同的对象。
与切换对象和刷新视图相比,使用 segue 是必要的,因为我的用户需要能够在点击后退按钮时返回到过去的视图控制器。
示例:
(ThisView,用 thisObject 填充视图)->(ThisView,用 thisOtherObject 填充视图)
我尝试过的:
presentView 控制器:这没有用,因为它不是我要实现的默认 segue。
let next: NewClubProfile = storyboard?.instantiateViewControllerWithIdentifier("clubProfile") as! NewClubProfile
presentViewController(next, animated: true, completion: nil)
使用 Navigation Controller:无法弄清楚如何使用新对象来填充另一个视图
let next: NewClubProfile = storyboard?.instantiateViewControllerWithIdentifier("clubProfile") as! NewClubProfile
self.navigationController?.pushViewController(next, animated:true)
在发布之前我应该花更长的时间自己解决这个问题,但我找不到符合我需要的答案。无论如何,解决了它,这对我有用。
let next: ViewController = storyboard?.instantiateViewControllerWithIdentifier("viewName") as! ViewController
next.object = newObject
self.navigationController?.pushViewController(next, animated:true)
我正在尝试从一个填充了对象数据的视图转到相同的视图,但通过 segue 填充了不同的对象。
与切换对象和刷新视图相比,使用 segue 是必要的,因为我的用户需要能够在点击后退按钮时返回到过去的视图控制器。
示例: (ThisView,用 thisObject 填充视图)->(ThisView,用 thisOtherObject 填充视图)
我尝试过的:
presentView 控制器:这没有用,因为它不是我要实现的默认 segue。
let next: NewClubProfile = storyboard?.instantiateViewControllerWithIdentifier("clubProfile") as! NewClubProfile
presentViewController(next, animated: true, completion: nil)
使用 Navigation Controller:无法弄清楚如何使用新对象来填充另一个视图
let next: NewClubProfile = storyboard?.instantiateViewControllerWithIdentifier("clubProfile") as! NewClubProfile
self.navigationController?.pushViewController(next, animated:true)
在发布之前我应该花更长的时间自己解决这个问题,但我找不到符合我需要的答案。无论如何,解决了它,这对我有用。
let next: ViewController = storyboard?.instantiateViewControllerWithIdentifier("viewName") as! ViewController
next.object = newObject
self.navigationController?.pushViewController(next, animated:true)