【发布时间】:2020-01-10 05:55:24
【问题描述】:
我现在正在学习 SwiftUI,并且正在编写教程。
但在 SwiftUI List 中,name 的部分被剪掉了。你有修饰符吗?
struct ContentView: View {
var body: some View {
List(modelData) {
Device in HStack {
Image(systemName: Device.image)
.frame(width: 50, height: 10, alignment: .leading)
Text("\(Device.name)")
.frame(width: 50, height: 10, alignment: .leading)
.scaledToFit()
VStack {
Text("\(Device.price)")
}
}
.font(.title)
}
}
}
【问题讨论】: