简体   繁体   中英

how to set text to split into 2 lines in swift uiTextField

I have a uiTextField with dynamic text.

How can I set it via the editor to split the text into 2 lines (or more)

if text doesn't fit in the uiTextField width?

Is there a way to do this not programmatically?

Now text is seen as

"This is a long line" ===>

"This is...."

and I want it to be

"This is a
 long line"

UITextField is one line only. You can not have multi line content in UITextField . If you want to have multi line then use UITextView .

正如Vishnu所说,您需要对多行文本字段使用UITextview ,还需要在其中想将字符串分成下一行的位置添加“ \\ n”,例如"This is a\\nlong line"

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