【发布时间】:2020-07-11 09:13:50
【问题描述】:
我有姓名Max 和文字。我希望文本在左侧的行截断之后(没有空格)。这样的事情在 SwiftUI 中是可能的吗?
照片:
我目前使用的代码是这样的:
struct NotificationUser: View {
var name: String
var text: String
var body: some View {
HStack(alignment: .top) {
Text(name)
.bold()
.padding(.horizontal, 5)
.padding(.vertical, 2)
.background(Color(.systemGray6))
.cornerRadius(5)
Text(text)
}
}
}
【问题讨论】:
-
您希望“has just ...”在 Max 的下方和左侧?
标签: swiftui