1

请帮帮我。关闭现有视图控制器后如何显示另一个视图控制器?这是我的代码:

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

    [self dismissModalViewControllerAnimated:YES];

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



}

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

4

2 回答 2

4

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

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

    [self dismissViewControllerAnimated:YES completion:^{
         ViewController *Vc = [[ViewController alloc]init];
         [self presentViewController:Vc animated:YES completion:^{}];
    }];
}
于 2012-11-14T19:07:43.633 回答
0

只需检查一下

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

希望这有效。

于 2012-11-14T19:07:56.617 回答