Last active
January 17, 2019 19:47
-
-
Save chuganzy/6cd5b915b759e60de389 to your computer and use it in GitHub Desktop.
モーダルで開いたUIViewControllerを一気に閉じる http://blog.ganzy.jp/objective-c/133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* とにかくモーダルを全部閉じる */ | |
// どこからでもOK | |
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:nil]; | |
// もしくはこちら | |
[[UIApplication sharedApplication].delegate.window.rootViewController dismissViewControllerAnimated:YES completion:nil]; | |
/* ある階層までのモーダルを閉じる */ | |
// 閉じる元からの場合 | |
[self.presentingViewController.presentingViewController.../*到達するまで*/ dismissViewControllerAnimated:YES completion:nil]; | |
// 閉じた先からの場合 | |
[self dismissViewControllerAnimated:YES completion:nil]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment