gpt4 book ai didi

ios - 分段选择器内的元素修饰符不起作用

转载 作者:行者123 更新时间:2023-12-01 18:36:02 25 4
gpt4 key购买 nike

我有一个代码:

@Binding var hand: Hand

var body: some View {
HStack {
Text("Hand: ")
Picker(selection: $hand, label: Text("Strength")) {
Text("JIUJIU").tag(0).foregroundColor(.blue)
Text("BLABLA").tag(1).rotationEffect(Angle(degrees: 35))
}.pickerStyle(SegmentedPickerStyle())
}
}

foregroundColor(.blue)rotationEffect(Angle(degrees: 35)) Picker 的元素内的修饰符.但实际上我看不到任何效果:

enter image description here

为什么修饰符不起作用?

最佳答案

这是你的pickerStyle() .文档说关于 SegmentedPickerStyle :

  • Note: Only supports segments of type Label and Image. Passing any other type of view will result in a visible, but empty, segment.


我想这就是为什么你只看到文字。我尝试过使用另一种风格,效果很好。

关于ios - 分段选择器内的元素修饰符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58864088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com