Slider

12/5/2021 swiftiosswiftui

# Slider

文档:https://developer.apple.com/documentation/swiftui/slider (opens new window)

从有界的线性范围中选择一个值的控件。

@State var progress: Float = 0

Slider(value: $progress, from: 0.0, through: 100.0, by: 5.0)

Slider 虽然没有 minimumValueImagemaximumValueImage 属性, 但可以借助 HStack 实现。

@State var progress: Float = 0
HStack {
    Image(systemName: "sun.min")
    Slider(value: $progress, from: 0.0, through: 100.0, by: 5.0)
    Image(systemName: "sun.max.fill")
}.padding()
上次更新: 6/18/2022, 10:39:15 AM