Search code examples
ioscocoa-touchuivewcontroller

iOS - Present viewcontroller from another presented viewcontroller


I have 3 view controllers, A, B and C. B is presented on A. What I need is to present C on A when a button clicked on B and dismiss B. But I am unable to do so. Is there some workaround. Thanks for help.


Solution

  • click the button on B, in iOS5,

    UIViewController *presentingVC = self.presentingViewController;
    [self dismissViewControllerAnimated:YES completion:^{
          [presentingVC presentViewController:vc3 animated:YES completion:nil];
    }];