iPhone - dismiss multiple ViewControllers

后端 未结 22 3051
粉色の甜心
粉色の甜心 2020-11-28 04:46

I have a long View Controllers hierarchy;

in the first View Controller I use this code:

SecondViewController *svc = [[SecondViewController alloc] i         


        
22条回答
  •  眼角桃花
    2020-11-28 05:38

      id vc = [self presentingViewController];
      id lastVC = self;
      while (vc != nil) {
        id tmp = vc;
        vc = [vc presentingViewController];
        lastVC = tmp;
      }
      [lastVC dismissViewControllerAnimated:YES completion:^{
    }];
    

提交回复
热议问题