【发布时间】:2019-11-14 02:47:33
【问题描述】:
我正在制作一个 swiftUI 日历,遇到了一个奇怪的 SwiftUI 文本视图截断问题。
struct test : View {
var body: some View {
GeometryReader { geometry in
HStack(alignment: .center, spacing: 0) {
ForEach(0..<7) { _ in
Text("Tue").frame(width: geometry.size.width / 7).border(Color.red, width: 2)
}
}
}
}
}
一开始我以为可能是因为Text View size不够大。但是当我减小文本视图宽度时,截断就消失了。我还尝试设置较小的字体,但它也不起作用。感谢您的任何提示!
struct test : View {
var body: some View {
GeometryReader { geometry in
HStack(alignment: .center, spacing: 0) {
ForEach(0..<7) { _ in
Text("Tue").frame(width: geometry.size.width / 8).border(Color.red, width: 2)
}
}
}
}
}
【问题讨论】:
标签: swiftui truncation