Reputation: 6323
In NSTextField all I have to do is add '\n' i.e.. @"hello\nthere" will be 2 lines:
hello
there
I tried this in UITextField and it all stayed on one line
hello there
What do I need to do to make text go to the next line?
thx
Upvotes: 2
Views: 723
Reputation: 12106
If you are supplying the text and the user doesn't need to edit it, use UILabel, and set it's property
numberOfLines = 2;
If the user does need to edit it, use a UITextView, and set it's frame.size.height to be at least twice the size of the font size you're using.
Upvotes: 3
Reputation: 963
You want to use UITextView, which supports multiple line text: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextView_Class/Reference/UITextView.html
UITextField only supports a single line: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextField_Class/Reference/UITextField.html
Upvotes: 2
Reputation:
UITextFields are one-line controls. They can't display multiple lines of text. Use UITextView for that purpose.
Upvotes: 2