Present multiple modal view controllers?

前端 未结 6 980
温柔的废话
温柔的废话 2020-12-29 08:05

update:
I\'ve faced this problem again, and found another way. If presenting controller is not embedded in navigation controller, it will be hidden if p

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 08:38

    Dismiss all view controllers above the presented view controller.

    Apple's documentation follows:

    If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.

    Dismiss two modal view controllers.

    [self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
    

    https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#jumpTo_51

提交回复
热议问题