我有此代码,每次使用它时,目标视图的viewDidLoad
都会被调用两次。
为什么会这样呢?
Destination *myDestination = [self.storyboard instantiateViewControllerWithIdentifier:@"destination "];
MyCustomSegue *segue = [[MyCustomSegue alloc] initWithIdentifier:@"CustomSegue" source:self destination : myDestination];
[segue perform];
最佳答案
我认为您可以通过调用presentViewController: animated: completion:;
方法来实现
例如
Destination *myDestination = [self.storyboard instantiateViewControllerWithIdentifier:@"destination "];
[self presentViewController:myDestination animated:YES completion:nil];
希望这对您有所帮助。
关于ios - UIStoryboard InstantiateViewControllerWithIdentifier调用了两次,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23189435/