你可以使用Button
方法 lineLimit(_:)
。
struct ContentView : View {
var body: some View {
Button("Hello World").lineLimit(nil)
}
}
Button
,可以像这样实现。请参考以下代码:
Button(action: {
print("Action goes here")
}, label: {
Text("Line 1 \n Line 2").lineLimit(nil)
})
调用中缺少参数'label'
。 - Jaydeep Vora