如何使用 Swift 将 viewcontroller 推送到导航堆栈?
How to push viewcontroller onto navigation stack using Swift?
我在 UIViewController 之前设置了 NavigationViewcontroller,我想以编程方式执行 segue 并将另一个 Viewcontroller 推入导航堆栈。我怎样才能做到这一点?
class CreateEventViewController: UIViewController, CLLocationManagerDelegate {
// Updated post with simple answer
// If you have a Naviagation Controller already instantiated then all you have to do is perform segue and it will push it on the navigation stack for you
self.performSegueWithIdentifier("Event Creation Success", sender: nil)
}
编辑:
我的故事板图片http://imgur.com/rgbNxI1
pushViewController
仅在您已经通过调用 performSegueWithIdentifier
设置了 segue 之后调用。将 pushViewController
调用响应初始化 segue 的任何操作。
因为我已经实例化了我的导航控制器并且有一个导航堆栈,我所要做的就是 performSegueWithIdentifier。不需要 pushViewController.
self.performSegueWithIdentifier("Event Creation Success", sender: nil)
我在 UIViewController 之前设置了 NavigationViewcontroller,我想以编程方式执行 segue 并将另一个 Viewcontroller 推入导航堆栈。我怎样才能做到这一点?
class CreateEventViewController: UIViewController, CLLocationManagerDelegate {
// Updated post with simple answer
// If you have a Naviagation Controller already instantiated then all you have to do is perform segue and it will push it on the navigation stack for you
self.performSegueWithIdentifier("Event Creation Success", sender: nil)
}
编辑:
我的故事板图片http://imgur.com/rgbNxI1
pushViewController
仅在您已经通过调用 performSegueWithIdentifier
设置了 segue 之后调用。将 pushViewController
调用响应初始化 segue 的任何操作。
因为我已经实例化了我的导航控制器并且有一个导航堆栈,我所要做的就是 performSegueWithIdentifier。不需要 pushViewController.
self.performSegueWithIdentifier("Event Creation Success", sender: nil)