How to insert a new line \ n from UILabel text that was entered in IB?

I have id textInput and I insert a new line (\ n) OK with:

[textInput insertText:@"\n"]; 

But when entering text from label.text (Input in Interface Builder) it is NOT OK. Just enter \ n text.

 NSLog(@"%@",label.text); [textInput insertText:label.text]; 

How to enter a special character when it is stored in label.text?

I do not want to compare [inputStr isEqualToString:@"\\n"];

* Log: \ n

Thank!

+44
ios objective-c nsstring
Mar 16 '13 at 2:40
source share
2 answers

Try the return option or insert on a new line.

+124
Mar 16 '13 at 3:32
source share

@Hot Licks explained the reason well in the comment.

The only way -

 if ([self.mylabel.text isEqualToString:@"\\n"]) { [self.myTextView insertText:@"\n"]; } 

Manually use ALT+ENTER

+11
Mar 16 '13 at 2:52
source share



All Articles