How to programmatically create a multi-line UIText field with multiple placeholders?

How to programmatically create a multi-line UITextfield?

I need to create a multi-line supporting text box with multiple placeholders. I do not want to reference its xib.

+4
source share
3 answers

You can do this with some tricks. Please check my answer here: UITextfield multiline field

+2
source

Your question is not entirely clear, so this might be the answer:

UITextView *textView ; textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 400, 50)] ; NSString *myMultilineString = [NSString stringWithFormat:@"nanan %d \nline2 %f\nline3 %@", 5, 1.45f, self] ; textView.text = myMultilineString ; textView.userInteractionEnabled = NO ; [self.view addSubview:textView] ; 
0
source

Take a look here: https://github.com/flypigz/UIPlaceHolderTextView This is a subclass of UITextView where the UILabel is added as a placeholder. You can add multiple shortcuts if you need multiple placeholders.

0
source

All Articles