8

So I have a delegate set up in one class which can potentially enter a segue. If I call this function from another view controller, will the segue be performed? Or can only view controllers directly connected to segues perform a segue?

4

1 回答 1

6

segue 是从一个视图控制器定义到另一个视图控制器,因此您必须从定义它的视图控制器调用。一种解决方法是简单地推送视图控制器而不使用 segue。你可以实例化你的视图控制器,假设你已经给它一个故事板ID。

UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"DestinationController"];

然后,您推送视图控制器。

[self.navigationController pushViewController:controller animated:YES];
于 2013-08-25T04:33:53.060 回答