繁体   English   中英

显示另一个ViewController

[英]Show another ViewController

请帮帮我。 在解除现有控制器之后,如何显示另一个视图控制器? 这是我的代码:

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

    [self dismissModalViewControllerAnimated:YES];

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



}

我的代码不起作用。 请帮帮我。 如果我在解除了ModellViewController之后编写了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:^{}];
    }];
}

只需检查一下

[self dismissModalViewControllerAnimated:NO];
Nextview *sec = [[Nextview alloc] initWithNibName:@"Nextview" bundle:nil];
[self presentModalViewController:sec animated:YES];
[sec release];

希望这有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM