[英]Having tabviewcontroller and navigation controller segue does not show bottom tabs
When my iOS app loads, there is a tab view controller that gets loaded with 3 tabs: charge, location, more
. 当我的iOS应用加载时,有一个标签视图控制器加载了3个标签:
charge, location, more
。 When you click on more, there is a option to to sign in. When the clicks on sign in -> signviewcontroller
gets shown where the user chooses their Google profile to sign in -> once successful, they should be directed to the Charge page. 当您单击更多按钮时,将有一个登录选项。当登录->
signviewcontroller
的点击显示在用户选择其Google个人资料登录->成功的位置时,应将其定向到“收费”页面。 If user does not sign in which would be the first time the app loads, normal tabs should be shown -> charge, location, more. 如果用户未登录(这是应用首次加载),则应显示常规标签->费用,位置等。
The problem is that I am not sure if I have aligned my TabViewController
and my NavigationController
correctly. 问题是我不确定我是否已正确对齐
TabViewController
和NavigationController
。 Once sign in is clicked, Signviewcontroller
does get shown and I also segue into ChargeViewController
but I dont see the tabs and the navigation bar item name charge although there is a blank navigation bar. 单击登录后,
Signviewcontroller
确实会显示,我也可以进入ChargeViewController
但是尽管有空白的导航栏,但我看不到选项卡和导航栏项名称收费。
Here is my segue code: 这是我的密码:
self.performSegue(withIdentifier: "signin_complete", sender: self)
Here is my storyboard layout, tried to extract the problem and showed below: 这是我的情节提要布局,试图提取问题并显示如下:
Should I layout my view controllers differently? 我应该以不同的方式布置视图控制器吗? I read that I need to add navigationcontroller which would fix the bottom tabs but it did not.
我读到我需要添加navigationcontroller,它将修复底部的选项卡,但没有。
GIF of what it looks like and notice how the last page charge does not show any tabs at the bottom. GIF外观,注意最后一页收费如何在底部不显示任何选项卡。 gif link
gif链接
You should remove segue that is between Signviewcontroller
and Navigation Controller - ChargeViewController
. 您应该删除
Signviewcontroller
和Navigation Controller - ChargeViewController
之间的Navigation Controller - ChargeViewController
。 Then Tabbar will be appeared on this navigation controller like Location
. 然后,Tabbar将出现在此导航控制器上,例如
Location
。
Here my example: 这是我的例子:
Then you should create own UITabBarController
class. 然后,您应该创建自己的
UITabBarController
类。 After that you can control your view controllers inside tabBar didSelect
. 之后,您可以在tabBar
didSelect
控制视图控制器。 Check signing status and root SignViewController or ChargeViewController. 检查签名状态和根SignViewController或ChargeViewController。
override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
let nav: UINavigationController = self.tabBarController?.viewControllers?.first as! UINavigationController
//get sign or charge view controller
nav.setViewControllers([sign or charge], animated: true)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.