UITextField - Multiple Lines
I'm trying to add lines to my UITextField (my code is below开发者_StackOverflow社区), however, when the typer gets to the end of the text field, instead of going to the next line it keeps going on the same line forever! How do I get it to go to the next line? Thanks.
fldNotes = [[UITextField alloc] initWithFrame:CGRectMake(labelLeft,controlTop+5,320 - (2 * labelLeft),200)];
fldNotes.text = te.notes;
fldNotes.placeholder = [theApp.adb GetHC:@"NotesName"];
fldNotes.clearButtonMode = UITextFieldViewModeWhileEditing;
fldNotes.tag = 100;
fldNotes.borderStyle = UITextBorderStyleRoundedRect;
[fldNotes setReturnKeyType:UIReturnKeyDone];
[fldNotes setEnablesReturnKeyAutomatically:YES];
fldNotes.delegate = self;
[contentView addSubview:fldNotes];
use a UITextView
instead. This allows for multi-line text.
You can also customize your UITextView to look alike UITextField by using this.
myTextView.layer.cornerRadius = 5;
[myTextView.layer setBorderColor:[[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor]];
[myTextView.layer setBorderWidth:2.0];
myTextView.clipsToBounds = YES;
Dont forget to import <QuartzCore/QuartzCore.h>
and you wil get rid of the error.
Hope this helps Someone:)
精彩评论