Is it possible to put a new line in a textfield
placeholder? something like:
comment1= [[[UITextField alloc]initWithFrame:frame2]autorelease];
comment1.placeholder = @"Write maximum 200 \r characters here";
Is it possible to put a new line in a textfield
placeholder? something like:
comment1= [[[UITextField alloc]initWithFrame:frame2]autorelease];
comment1.placeholder = @"Write maximum 200 \r characters here";
UITextField
is meant to show only single line. If you wish to show multiple line text you'll have to use UITextView
. Or, you can use UILabel
and set the number of lines property. In iPhone "\n" is new line character. However, it won't work with UITextField
.
UITextField does not have any property or facility to create new line in it. You can use UITextView instead. Here is the code sample..
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if([text isEqualToString:@"\n"])
{ //Enter your code here }}