问题
Just wonder if it is possible to use multiple lines in UITextField in XCode. I know how to increase the height size. but have know idea about its lines :/
回答1:
Ok I did it with some trick ;) First made a UITextField and increased it's size like this :
CGRect frameRect = textField.frame
frameRect.size.height = 53
textField.frame = frameRect
Then I made a UITextView exactly in the same area that i made my UITextField, and deleted its background color. Now it looks like that I have a multiple lines TextField !
Check this: https://stackoverflow.com/a/13476467/1572408
回答2:
Unfortunately, UITextField is specifically one-line only. You will need to use a UITextView instead of UITextField for displaying and editing multiline text; it will be multiline by default.
回答3:
You could use UITextView instead, which is a "mini-notepad" view.
来源:https://stackoverflow.com/questions/13475961/uitextfield-multiple-lines