为什么NavigationLink背景为灰色?

我正在跟随SwiftUI tutorial使用SwiftUI创建我的第一个应用程序,但是在TVO上,我不知道为什么,但是滚动视图项的背景颜色为灰色,当它们被聚焦时它们变成白色。 我找不到改变颜色的方法...

能帮我吗?

为什么NavigationLink背景为灰色?

我的代码:

struct LigneCategorie: View {
    var nomCategorie: String
    var items: [Recette]

    var body: some View {
        VStack(alignment: .leading) {
            Text(self.nomCategorie)
                .font(.headline)
                .padding(.leading,15)
                .padding(.top,5)

            ScrollView(.horizontal,showsIndicators: false) {
                HStack(alignment: .top) {
                    ForEach(self.items) { recette in
                        NavigationLink(
                            destination: RecetteDetail(
                                recette: recette
                            )
                        ) {
                            CategoryItem(recette: recette)
                        }
                    }
                }
            }
            .frame(height: 185)
        }
    }
}


struct CategoryItem: View {
    var recette: Recette
    var body: some View {
        VStack(alignment: .leading) {
            recette.image
                .renderingMode(.original)
                .resizable()
                .frame(width: 200,height: 150)
                .cornerRadius(10)
            Text(recette.name)
                .foregroundColor(.primary)
                .font(.caption)
        }
        .padding(.leading,15)

    }
}

谢谢

yehuan19840620 回答:为什么NavigationLink背景为灰色?

您可以在预览侧设置学校视图的背景。当您单击滚动视图时,您将在预览模式下看到选定的滚动视图。必须显示字体,颜色和类似选项。但是,如果没有,请尝试此操作。

subset(DF,B == 1| B==2)
本文链接:https://www.f2er.com/3142919.html

大家都在问