garaster 2012-11-15 01:56 采纳率: 0%
浏览 2772
已采纳

怎么显示另一个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 2012-11-15 02:45
    关注
    [self dismissModalViewControllerAnimated:YES];
    

    这句有问题;

    试试这个:

    - (void)matchmakerViewControllerWasCancelled:
    (GKMatchmakerViewController *)viewController{
    
        [self dismissViewControllerAnimated:YES completion:^{
             ViewController *Vc = [[ViewController alloc]init];
             [self presentViewController:Vc animated:YES completion:^{}];
        }];
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题