【问题标题】:Is there any way to create BottomBar using SwiftUI有什么方法可以使用 SwiftUI 创建 BottomBar
【发布时间】:2019-12-14 12:24:45
【问题描述】:

我想创建一个bottom bar,这对于我的所有页面来说都是通用的

【问题讨论】:

    标签: ios swift swiftui ios13


    【解决方案1】:

    这种视图在 iOS 中称为标签栏,在 SwiftUI 中称为TabView。它是这样声明的:

    var body: some View {
        TabView {
            Text("Favourites Screen")
                .tabItem {
                    Image(systemName: "heart.fill")
                    Text("Favourites")
            }
            Text("Friends Screen")
                .tabItem {
                    Image(systemName: "person.fill")
                    Text("Friends")
            }
            Text("Nearby Screen")
                .tabItem {
                    Image(systemName: "mappin.circle.fill")
                    Text("Nearby")
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-06
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2020-02-09
      • 2013-08-04
      • 1970-01-01
      相关资源
      最近更新 更多