简体   繁体   中英

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 storyboard 在此处输入图片说明

在此处输入图片说明

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM