【问题标题】:How do I remove the three dots tab?如何删除三个点标签?
【发布时间】:2020-04-18 13:16:46
【问题描述】:

所以我在 SwiftUI 中创建了一个选项卡视图,但它一直显示“三个点更多”选项卡。如何删除它?

标签视图{

        Text("")
            .tabItem {
                Image(systemName: "house")
                Text("Home")
        }
        Text("")
            .tabItem {
                Image(systemName: "magnifyingglass")
                Text("Search")
            }
        Text("")
            .tabItem {
                Image(systemName: "plus")
                Text("Add")
            }
        Text("")
            .tabItem {
                Image(systemName: "suit.heart")
                Text("Likes")
            }
        Text("")
            .tabItem {
                Image(systemName: "person")
                Text("Profile")
            }

    }//end tabview

【问题讨论】:

  • 这在最新的 Xcode 中没有显示。

标签: swiftui tabview


【解决方案1】:

如果没有更多代码,很难确定这种行为的原因。

  1. 检查 SceneDelegate window.rootcontroller 是否指向 TabView 所在的结构,而不是正常的 contentView

  2. 用以下视图替换文本字符串:

    TabView{
       FirstView()
           .tabItem {
               Image(systemName: "house")
               Text("Home")
       }
    

    }

  3. 检查,Tabview 和第一个 TabItem 之间没有 Text,因为 TabView 将其解释为额外的 Tabitem

    
    TabView{
        Text("this causes the error")
        FirstView()
            .tabItem {
                Image(systemName: "house")
                Text("Home")
        }
    

有了这三个提示,你的 Tabbar 应该可以工作了

我正在使用 Xcode 11.3

【讨论】:

  • 您的第一句话是结束问题的理由,而不是回答它。首先要求更多代码。不要猜测意图:How to Answer
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-14
  • 2015-01-23
  • 1970-01-01
相关资源
最近更新 更多