I have id textInput and I insert new line(\n) OK with:
[textInput insertText:@"\n"];
But when input Text from label.text (Input in Interface Builder) ,it NOT OK. Just input \n text.
NSLog(@"%@",label.text); [textInput insertText:label.text];
How to input special character when store it in label.text?
I don't want to compare [inputStr isEqualToString:@"\\n"];
*Log: \n
Thanks!
To add line breaks in the text we'll use \n character in the string we want to assign to the label.
If you set numberOfLines to 0 (and the label to word wrap), the label will automatically wrap and use as many of lines as needed. If you're editing a UILabel in IB, you can enter multiple lines of text by pressing option + return to get a line break - return alone will finish editing.
To change the font or the size of a UILabel in a Storyboard or . XIB file, open it in the interface builder. Select the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.
Try option-return or pasting in the newline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With