Disabling multiple modal views

My application presents a modal view (A) from the main view, which allows the user to make a choice. When they make this choice, he reveals a second kind of modality (B) on top of the first (A).

When I finished the second kind of modality (B) and want to reject it, I would like to reject the first (A) and second (B) at the same time that I no longer need the user to return to this (A).

The only thing I came up with is:

[self.parentViewController.parentViewController.parentViewController. dismissModalViewControllerAnimated:YES];

It works, but it doesn’t look right. Is this ok to do or is there a more acceptable way to do this?

+3
source share
2 answers

, . , Apple :

, , , , , ; . , , .

+3
(UIApplication.sharedApplication().delegate! as! AppDelegate).navigationController?.viewControllers.first?.dismissViewControllerAnimated(true, completion: nil)
0

Source: https://habr.com/ru/post/1752753/


All Articles