Dismiss ModalView does not work here <p>So I have a tabBarController as a modalview, and it shows up fine. As I click some of the tabs, the views are loading properly. I want to dismiss the modalView when I click on <code>tabBarController.selectedIndex ==4</code></p> <p>So I write in the <code>viewDidLoad</code> and also tried in the <code>viewWillAppear</code> of that view controller to <code>dismissModalViewController</code> and it does not work.</p> <p>I tried</p> <pre><code>[self.parentViewController dismissModalViewControllerAnimated:YES]; // ... And also // [self dismissModalViewControllerAnimated:YES]; </code></pre> <p>Could someone point out why it does not work ?</p>