【发布时间】:2020-06-15 05:54:05
【问题描述】:
我无法弄清楚为什么我的文字下方有一些间距。
struct testView: View {
@State private var notes = ""
var body: some View {
VStack {
Text("Larg Text").font(.system(size: 70))
.background(Color.red)
TextField("Add a note", text: $notes)
.background(Color.red)
Spacer()
}
.background(Color.yellow)
}
}
出于某种原因,Text 和 TextField 之间有一个神秘的空间。如果我这样做,这个空间似乎会减少
- 减小字体大小
- 不要指定字体大小
- 不要在文本视图之后使用 TextField
- 不要在 TextField 之前使用 Text 视图
换句话说,这种与字体大小相关的间距似乎只发生在 Text 和 TextField 之间。我完全糊涂了。我想摆脱这个空间。
感谢您的帮助!
【问题讨论】: