2 garaster garaster 于 2012.11.15 09:56 提问

怎么显示另一个ViewController??

在解散一个ViewController之后怎么显示另一个ViewController?
我的代码没实现,不知道在哪儿有错误

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

    [self dismissModalViewControllerAnimated:YES];

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



}

如果在ModalViewController之后写NSLog,就会显示NSLog ,但是没有显示ViewController

1个回答

MrsSeven7
MrsSeven7   2012.11.15 10:45
已采纳
[self dismissModalViewControllerAnimated:YES];

这句有问题;

试试这个:

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

    [self dismissViewControllerAnimated:YES completion:^{
         ViewController *Vc = [[ViewController alloc]init];
         [self presentViewController:Vc animated:YES completion:^{}];
    }];
}
Csdn user default icon
上传中...
上传图片
插入图片