gpt4 book ai didi

ios - UIStoryboard instantiateViewControllerWithIdentifier 调用了两次

转载 作者:行者123 更新时间:2023-11-29 12:47:52 26 4
gpt4 key购买 nike

我有这段代码,每次我使用它时,目标 View 的 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com