简体   繁体   中英

Even if I align text, it is not set to left aligned

I am trying to align left text in Text component in Swift UI.

阿灵文

As you can see on above image I applied with below code but does not work. Anything missing?

Text(titleSring).frame(alignment: .trailing).background(Color.red)

A frame alignment is for entire view (which is square), you need multi-line text alignment, like

Text(titleSring)
    .multilineTextAlignment(.leading)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM