gpt4 book ai didi

iphone - 显示另一个 ViewController

转载 作者:行者123 更新时间:2023-12-01 18:26:25 25 4
gpt4 key购买 nike

请帮帮我。关闭现有 View Controller 后如何显示另一个 View Controller ?这是我的代码:

- (void)matchmakerViewControllerWasCancelled:
(GKMatchmakerViewController *)viewController{

[self dismissModalViewControllerAnimated:YES];

ViewController *Vc = [[ViewController alloc]init];
[self presentModalViewController:Vc animated:YES];



}

我的代码不起作用。请帮帮我。如果我在关闭ModalViewController 后编写NSLog,它会显示NSLog,但不会显示ViewController。谢谢

最佳答案

[self dismissModalViewControllerAnimated:YES];已被弃用。尝试做:

- (void)matchmakerViewControllerWasCancelled:
(GKMatchmakerViewController *)viewController{

[self dismissViewControllerAnimated:YES completion:^{
ViewController *Vc = [[ViewController alloc]init];
[self presentViewController:Vc animated:YES completion:^{}];
}];
}

关于iphone - 显示另一个 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13385500/

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