Home > AI > IOS > SwiftUI >

multilineTextAlignment

Make TextField text center.

Example:

TextField("分享见解,下一个八炸就是你...", text: $comment)
    .font(home.fontFootnote)
    .foregroundColor(.black)
    .frame(minWidth: 0, maxWidth: .infinity)
    .frame(height: home.defaultPadding*2)
    .multilineTextAlignment(.center)
    .background(Color("lightGray"))
    .clipShape(Capsule())

Leave a Reply