在故事板中,rootViewController是登录后的LoginViewController我要去UITabbarController。 在标签栏控制器上有列表。单击单元格后,我将转到另一个ViewController。这个过程正常,但后退按钮问题 最后,当我点击后退按钮时,它直接导航到Login View Cotroller而不是UITabbarController
这是故事板
的屏幕截图
登录按钮方法
- (IBAction)SDBtnLogin:(id)sender
{
SDTabFavorites *sdTabFavViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"tabVC"];
[self.navigationController pushViewController:sdTabFavViewController animated:YES];
}
选择了SDTabFavorites ViewController的方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SDDetailViewController *sdDetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SDDetailViewController"];
[self.navigationController pushViewController:sdDetailViewController animated:YES];
}
导航到SDDetailViewController后尝试返回然后直接进入登录视图控制器。
答案 0 :(得分:1)
永远不要将VC从登录/注册推送到主屏幕。始终在模型序列中显示它。你需要替换
[self.navigationController pushViewController:sdTabFavViewController animated:YES];
到
[self.navigationController presentViewController:sdTabFavViewController animated:YES completion:NULL];
主屏幕不应该有任何后退按钮返回登录/注册页面。
答案 1 :(得分:0)
谢谢,它帮助我在Xamarin.iOS,我改变了:
HomePageViewController homePage =
this.Storyboard.InstantiateViewController("HomePageViewController") as
HomePageViewController;
NavigationController.ShowViewController(homePage, this);
到
HomeTabController homePage =
this.Storyboard.InstantiateViewController("HomeTabController") as
HomeTabController;
await NavigationController.PresentViewControllerAsync(homePage, true);