Swiftui - 正确处理根导航内的选项卡导航
我的 swiftUI 应用程序导航的结构如下所示,
View : A
{
Navigation View {
// List View on click
// Takes me to a Tab View
NavigationLink(destination : Tab View)
}
}
View : Tab View
{
ViewX
.tag(0)
.tabItem {
Image(systemName: "video.bubble.left.fill")
Text("View X")
.font(Font.custom("Roboto-Black", size: 30))
}
ViewY
.tag(0)
.tabItem {
Image(systemName: "video.bubble.left.fill")
Text("View Y")
.font(Font.custom("Roboto-Black", size: 30))
}
}
使用此结构我无法正确控制视图的导航标题。 如果我将每个选项卡项包装在导航视图中,我最终会按预期得到多个导航标题栏。 是否有任何特定方法(例如隐藏根导航栏)可以在嵌套视图中拥有一个具有适当标题更新的导航栏?
The structure of my swiftUI app navigation is as below
View : A
{
Navigation View {
// List View on click
// Takes me to a Tab View
NavigationLink(destination : Tab View)
}
}
View : Tab View
{
ViewX
.tag(0)
.tabItem {
Image(systemName: "video.bubble.left.fill")
Text("View X")
.font(Font.custom("Roboto-Black", size: 30))
}
ViewY
.tag(0)
.tabItem {
Image(systemName: "video.bubble.left.fill")
Text("View Y")
.font(Font.custom("Roboto-Black", size: 30))
}
}
With this structure I'm not able to control the navigation title of the view correctly.
If I wrap each tab item in a navigation view, I end up with multiple navigation title bars as expected.
Any particular approach (like hiding the root navigation bar) to have one navigation bar with appropriate title updates in nested views ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将无法自动更新导航标题,您需要执行以下操作:
you won't be able to update the navigation Title automatically you will need to do something like this: