我已将Color.orange添加到我的ZStack中,但是我的视图仍然具有默认的白色/灰色背景:

struct Settings: View {
    @State var minAge = UserSettings().minAge
    @State var maxAge = UserSettings().maxAge
    @State var chosenSeeking = UserSettings.Seeking.both

    var body: some View {
        ZStack {
            Color.orange
            VStack {
                NavigationView {
                        Form {
                            Section {
                                Picker("Look for", selection: $chosenSeeking) {
                                    ForEach(UserSettings.Seeking.allCases) { i in
                                        Text(String(i.rawValue))
                                    }
                                }
                            }
                            Section {
                                Text("Min age")
                                Slider(value: $minAge, in: 18...99, step: 1, label: {Text("Label")})
                                    Text(String(Int(minAge)))
                            }
                            Section {
                                Text("Max age")
                                Slider(value: $maxAge, in: 18...99, step: 1)
                                Text(String(Int(maxAge)))
                            }
                        }.navigationBarTitle(Text("Settings"))
                    }
            }
        }
    }
}

ios - ZStack没有改变颜色-LMLPHP

知道是什么问题吗?

最佳答案

我能找到的最好的是colorMultiply:

NavigationView {
    ...
}.colorMultiply(.orange)

关于ios - ZStack没有改变颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62240204/

10-09 02:21