0

我目前正在将我的应用程序从界面生成器切换到 SwiftUI。我将一个水平 UIPickerview 转移到 SwiftUI 上,它的工作原理几乎相同,如果不是比以前更好的话。

问题:选择器视图中的内容(图像)比以前小得多。

问题:是否可以调整选取器中的行大小以使图像更大?

这是我的以图像为内容的水平选择器。

@State private var data = UserDefaults.standard.integer(forKey: “DataIndex")
var images = [“example”, “example”, …]

Picker(selection: $data, label: Text(“Data”)) {
    ForEach(images, id: \.self) { image in
        Image(image)
        .resizable()
        .scaledToFit()
        .rotationEffect(Angle(degrees: 90))
    }
}
.labelsHidden()
.rotationEffect(Angle(degrees: -90))
.frame(maxHeight: 100)
.clipped()
4

0 回答 0