ios - Swift UI - Wheel Picker,更改对齐方式和字体大小
问题描述
是否可以自定义车轮选择器字体并将对齐方式更改为.leading
?
解决方案
我想这将是你所期望的。
struct ContentView: View {
let colors = ["Red", "Yellow", "Green", "Gray", "Black", "Purple", "White", "Brown", "Pink", "Blue"]
@State private var color = "Red"
var body: some View {
Picker(selection: $color, label: Text("")) {
ForEach(self.colors, id: \.self) { color in
HStack {
Text(color)
.font(.title)
.padding()
Spacer()
}
}
}
.pickerStyle(WheelPickerStyle())
.labelsHidden()
}
}
谢谢,X_X
推荐阅读
- python - 带下划线的字符串到 Pascal 大小写
- javascript - Bootstrap Js 文件不适用于 Angular 8
- c++ - 如何使用 fstream 将字符串用于 .get?
- project-reactor - 使用带有重试的 Spring WebClient 时使用 StepVerifier 块进行测试
- java - 尝试获取数据时出现数字格式异常
- sql-server - 将 SQL 中的日期格式从 1980-12-17 00:00:00.000 更新为 SQL 中的 17-Dec-80
- wpf - Wpf Material Design 日期选择器主题
- kubernetes - k8s是否支持https liveness和readness probe
- linux - Arch Linux 的默认用户名和密码是什么
- python - 为什么 keras model.fit_generator() 显示错误,例如无法获得卷积算法?