dismissViewControllerAnimated VS popViewControllerAnimated
-dismissViewControllerAnimated:completion:
Used to dismiss an UIViewController
, which was presented by the method:
-presentViewController:animated:completion:
.
-popViewControllerAnimated:
Method of UINavigationController
is used to pop a controller shown by
-pushViewController:animated
method of UINavigationController
.
In the first case the view controller's view shows as a modal controller (usually from bottom to top), and the second case you are pushing a view controller in the navigation stack of UINavigationController
.
your selected application is navigation based application means
[self.navigationController popViewControllerAnimated:YES];
your selected application is other than the navigation based application means
[self dismissViewControllerAnimated:YES completion:nil];