How to make UITextField text in multiple lines

In my application, I have a text box that the user can fill out. In most cases, it will be a rather long text that I use UITextField, but it does not move to a new line when the user types the iPhone screen. How do I go to the next line?

+3
source share
3 answers
 Just Go With UITextView instead of UITextField.
+10
source

UITextField does not provide any option for creating a multi-line text field. So you have to go with a UITextView.

In the interface builder, place a UITextView and connect to IBOutlet. I assume you know how to do this.

, UITextView IBOutlet . viewDidLoadmethod.

- (void)viewDidLoad
{
    [super viewDidLoad];

    address.layer.cornerRadius = 5;
    [address.layer setBorderColor:[[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor]];

    [address.layer setBorderWidth:2.0];
    address.clipsToBounds = YES;
}

QuarzCore

#import <QuartzCore/QuartzCore.h>

TextView TextFiled.

, .

+5

I'm not sure, but maybe this can help you:
- go to the interface builder
- Change the border to your type in the text field attributes
- some borders are made, so you can change the size and that's it

Hope this helps!

0
source

All Articles