我想更改步进器的前景色,但找不到适用的属性。我更愿意保留标准步进器并更改颜色,而不必创建自定义步进器。
accentColor和foregroundColor不起作用。
Stepper(value: $timer, in: 1...30) {
Text("\(timer) " + "minutes")
.foregroundColor(.red)
}
.accentColor(.red)
.foregroundColor(.red)
}
Run Code Online (Sandbox Code Playgroud)
这:
对此:
这甚至可能是atm吗?
在视图 init.. 中设置 setDecrementImage、setIncrementImage 图像
struct ContentView: View {
init() {
UIStepper.appearance().setDecrementImage(UIImage(systemName: "minus"), for: .normal)
UIStepper.appearance().setIncrementImage(UIImage(systemName: "plus"), for: .normal)
}
var body: some View {
Stepper(value: $timer, in: 1...30) {
Text("\(timer) " + "minutes")
.foregroundColor(.red)
}
.accentColor(.red)
.foregroundColor(.red)
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2066 次 |
最近记录: |