Ios SwiftUI会截断某些字母的文本
我在SwiftUI中创建了下面的视图。它适用于某些单词,但对于某些长度相同的单词,它会截断文本,请参见下图。我使用的是Xcode 11.6Ios SwiftUI会截断某些字母的文本,ios,swiftui,Ios,Swiftui,我在SwiftUI中创建了下面的视图。它适用于某些单词,但对于某些长度相同的单词,它会截断文本,请参见下图。我使用的是Xcode 11.6 var body: some View { VStack { Text("John") //Problem with this line if I change text to "Aohn"/"aohn" it is truncating text.
var body: some View {
VStack {
Text("John") //Problem with this line if I change text to "Aohn"/"aohn" it is truncating text.
.font(.title)
.padding([.leading,.trailing],10)
.background(Color.yellow)
.foregroundColor(Color.white)
.cornerRadius(10)
HStack {
Text("Regular")
.padding()
.background(Color.gray)
.foregroundColor(Color.white)
.cornerRadius(10)
Text("Medium")
.padding()
.background(Color.blue)
.foregroundColor(Color.white)
.cornerRadius(10)
}
}
}
这里有一个固定值-使用固定大小。使用Xcode 11.4/iOS 13.4进行测试
VStack {
Text("aohn").fixedSize() // << here !!
VStack{
Text(“aohn”).fixedSize()//为什么我们需要添加fixedSize()?,这是SwiftUI缺陷吗?我可以回答为什么,有时……为什么都是或