Should I call rejectViewController on the modal UIViewController or the UIViewController that introduced it?

It seems to work anyway, but why and how, and what is the best way?

+1
source share
1 answer

Why and how

Say, viewing controller A introduced B, and B, in turn, introduced C.

When you call dismissViewControllerAnimated:completion:, iOS checks to see if the controller of the view you are calling it has a child in the property presentedViewController. If so, then it rejects this controller.

So, if I call him B in our example, he will reject C, but if I call him A, he will reject B (which takes C with him).

C, . , iOS presentingViewController. , . , C, iOS B, C.

, B C C, A B C.

B, , , .

  • ,

  • , - C (D), ( D, ).

+6

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


All Articles