I have a UITabBarController in my application.
I would like to present from one tab, another UIViewController.
So I wrote in ViewControllerA
(which is a tab in the tabviewcontroller):
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
MyViewController *chooseTemplateController = [storyboard instantiateViewControllerWithIdentifier:@"myController"];
[self.tabBarController presentViewController:myController animated:NO completion:nil];
This shows MyViewController nicely.
However, how can I dismiss MyViewController?
I read in many questions that I need to call:
[self.tabBarController dismissViewControllerAnimated:NO completion:nil];
However - where do I call it from? I tried from MyViewController - but since it's not part of the UITabBar, self.tabBarController is null.
I initialize the UiTabBarController from storyboard and not from appDelegate and I would like to leave it that way.
Use the presented viewController's
presentingViewController
propertyObjective-C
Swift
You can also use this shorthand version (I don't recommend you do, but you will see it often)
Objective-C
Swift
see
Dismissing a Presented View Controller