Problem dismissing multiple modal view controllers

后端 未结 9 1623
暗喜
暗喜 2020-12-09 10:43

I am having trouble getting my modal view controllers to display properly. I have a parent view controller that is the delegate for modal view A. In modal v

相关标签:
9条回答
  • 2020-12-09 11:44

    may be after long but.. I am in same problem and this is the only post with some answer. I am not getting what you mean by setting delegate of a parentViewController to self is not allowed .

    what I am doing right now is

    [self presentModalViewController:ViewControllerA animated:YES];
    [self dismissModalViewControllerAnimated:YES];// inside ViewControllerA
    [self presentModalViewController:ViewControllerB animated:YES];
    [self dismissModalViewControllerAnimated:YES];// inside ViewControllerB
    

    Problem is after viewControllerA , viewControllerB view is not presenting.

    Thanks,

    0 讨论(0)
  • 2020-12-09 11:46

    Solved by having my parentViewController act as the delegate. Here is my order:

    [parentView presentViewController:modalViewControllerA animated:YES]
    [parentView dismissModalViewControllerAnimated:YES]
    [parentView presentViewController:modalViewControllerB animated:YES]
    //Modal B dismisses himself
    

    In my delegate method, I needed to make sure that I dismissed Modal A before presenting Modal B

    0 讨论(0)
  • 2020-12-09 11:48

    You could use this

    [[[self presentingViewController] presentingViewController]  dismissModalViewControllerAnimated:YES];
    
    0 讨论(0)
提交回复
热议问题