Modal view controller pushed from tab view controller always returning to first tab

76 Views Asked by At

I have a view controller inside a tab bar controller (the view controller is item index 2). When I push a modal (camera picker) from the view controller, when it dismisses it always returns to the first view controller in the tab bar controller (item index 0). Now I COULD set the tab upon completion of dismissal, but that creates an ugly "flash effect" where it shows the first view controller for about a milisecond before going back to the right one. It's quite ugly from a design standpoint. How can I fix it? Here's what I have now that is ugly:

[picker dismissViewControllerAnimated:NO completion:^{
    UINavigationController * nav=self.navigationController;
    RootTabBarController * root=(RootTabBarController *)nav.parentViewController;

   [root showProfilePage]; //this calls setSelectedIndex in the tab bar controller
}];
1

There are 1 best solutions below

0
On

I accidentally set SetSelectedIndex=0 in the tab bar controller view did appear.