How to center UITextField text in Swift

后端 未结 3 1472
礼貌的吻别
礼貌的吻别 2021-01-01 10:48

I have a UITextField object with the text property set to \"hi\". However these two lines have no affect on where \"hi\" is located

 myUITextObject.contentVe         


        
3条回答
  •  醉梦人生
    2021-01-01 11:31

    You would want to write it like this:

    myUITextObject.textAlignment = .center
    

    (Edited to change from .Center to .center)

提交回复
热议问题