Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
モーダルで開いたUIViewControllerを一気に閉じる http://blog.hoppenichu.com/objective-c/133
/* とにかくモーダルを全部閉じる */
// どこからでも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