I have a single view whose only UI element is a UITextView
. In viewDidLoad:
I create an attributed string with "Text\n" and set the text view's attributed text as such:
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"Text\n"];
[self.textView setAttributedText:string];
My problem is that the line break is ignored when I run the app.
If I use an NSString
and setText:
that doesn't happen.
NSString *string = [[NSString alloc] initWithString:@"Text\n"];
[self.textView setText:string];
Can anyone shed some light on what is happening? I can't seem to find anything in documentation or otherwise.
NSAttributedString
can not useappendAttributedString
because it can not be changed. Is it correct useNSMutableAttributedString
? – African