Vinod Jadhav Vinod Jadhav - 8 months ago 89
iOS Question

Navigate from UIViewController to UITabbarController and than Tabbar to Another View Controller

In Storyboard rootViewController is LoginViewController After Login I am going to UITabbarController.
on Tab Bar Controller there is list. after click on cell I am going to another ViewController. this process work right but problem at back button
At the end when I click on back button it directly navigate to Login View Cotroller instead of UITabbarController

here is Screen shot of storyboardenter image description here

enter image description here

Login button Method

- (IBAction)SDBtnLogin:(id)sender
SDTabFavorites *sdTabFavViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"tabVC"];
[self.navigationController pushViewController:sdTabFavViewController animated:YES];

Did select method of SDTabFavorites ViewController

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
SDDetailViewController *sdDetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SDDetailViewController"];
[self.navigationController pushViewController:sdDetailViewController animated:YES];

After Navigate to SDDetailViewController and try try to back then directly goes to login view controller.

Answer Source

Never push VC from login/register to home screen. Always show it in model seque. You need to replace

[self.navigationController pushViewController:sdTabFavViewController animated:YES];


[self.navigationController presentViewController:sdTabFavViewController animated:YES completion:NULL];

The Home screen should not have any back button to go back to login/register page.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download