1

I was wondering how I could create a UITextField that would create a new line when the text reaches it's edge.

Here how I am creating the text view:

UITextField *textField = [[UITextField alloc] init]; textField.frame = CGRectMake(0, 194, 320, 568); textField.contentVerticalAlignment = UIControlContentVerticalAlignmentTop; textField.backgroundColor = [UIColor whiteColor]; UIView *textPaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 7, 20)]; textField.leftView = textPaddingView; textField.leftViewMode = UITextFieldViewModeAlways; [self.view addSubview:textField]; 

1 Answer 1

3

No, you shouldn't do that. UITextField is only designed to have one line of text. The control that you should be using is UITextView, which supports the behavior you've described natively.

Sign up to request clarification or add additional context in comments.

2 Comments

With a UITextView, can the user write the text @jafar
@matthew The user can enter any text into a text view.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.