0

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.

4
  • Are you using default back button of UINavigationController?? Commented May 7, 2015 at 6:13
  • yes I am using default back button Commented May 7, 2015 at 6:14
  • @VinodJadhav i think there is no back button for tabViewController... and using going Back to TabViewController.. So that is the problem. Commented May 7, 2015 at 6:19
  • Your SDDetailViewController is next view after SDTabFavorites right? Commented May 7, 2015 at 6:19

2 Answers 2

1

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];

to

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

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

Sign up to request clarification or add additional context in comments.

Comments

0

Thanks, it help me in Xamarin.iOS, I changed :

HomePageViewController homePage = 
this.Storyboard.InstantiateViewController("HomePageViewController") as 
HomePageViewController;
NavigationController.ShowViewController(homePage, this);

to

HomeTabController homePage = 
this.Storyboard.InstantiateViewController("HomeTabController") as 
HomeTabController;
await NavigationController.PresentViewControllerAsync(homePage, true);    

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.