栏项目不显示我何时以编程方式使用segue
我正在构建一个具有只有现有用户才能登录到的主VC的应用程序。主页是初始VC,因此我将导航栏嵌入到它。当我第一次打开应用程序时,我可以看到栏项目,但是当我登录并再次登录时,我看不到bar项目,有人知道为什么吗?我应该添加一些代码吗?还是更改一些定义?
我以这样的方式编程使用SEGUE:
private var handle: AuthStateDidChangeListenerHandle?
handle = Auth.auth().addStateDidChangeListener({ (auth, user) in
if user == nil{
if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Home") as? MainVC
{
self.present(vc, animated: true, completion: nil)
}
}else{
//keep going with the code...
})
在模拟器中,它从主VC开始,然后签名(PIC 1),然后登录(PIC 2)并返回主VC,但现在看不到条件(图3)。
I’m building an app which has a main vc that only existing user can log in to. The main page is the initial vc so I embed in the navigation bar to it. When I open the app in the first time I can see the bar items, but when I sign out, and log in again I can’t see the bar items, someone know why? Should I add some code? or maybe change some definitions?
I’m using segue programmatically like this:
private var handle: AuthStateDidChangeListenerHandle?
handle = Auth.auth().addStateDidChangeListener({ (auth, user) in
if user == nil{
if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Home") as? MainVC
{
self.present(vc, animated: true, completion: nil)
}
}else{
//keep going with the code...
})
In the simulator it starts with the main vc then I sign out (pic 1), then I log in (pic 2) and get back to the main vc but now I can’t see the bar items (pic 3).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在NavigationController私有VAR句柄中介绍您的主要风险
投资:AuthstatedIdIdChangelisTenerHandle?
hander = auth.auth()。
如果用户== nil {
you must present your main vc in navigationcontroller
private var handle: AuthStateDidChangeListenerHandle?
handle = Auth.auth().addStateDidChangeListener({ (auth, user) in
if user == nil{