SwiftUI text-alignment

后端 未结 9 1527
逝去的感伤
逝去的感伤 2020-12-29 00:42

Among the many properties of the Text view, I couldn\'t find any related to text alignment. I\'ve seen in a demo that it automatically handles RTL, and when pla

9条回答
  •  生来不讨喜
    2020-12-29 01:07

    From SwiftUI beta 3 forward, you can center a text view with the frame modifier:

    Text("Centered")
        .frame(maxWidth: .infinity, alignment: .center)
    

提交回复
热议问题