This is my code to display an attributed string in a UITextView
NSMutableAttributedString *recipeString =[[NSMutableAttributedString alloc]init];
[recipeString appendAttributedString:string1];
[recipeString appendAttributedString:string2];
[array addObject:recipeString];
This code is inside a for
loop. string1
and string2
are NSMutableAttributedString
s.
After that:
self.textView.text = [array objectAtIndex:self.appDelegate.selectedCell];
The text view is an IBOutlet
.
It crashes with this exception:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteAttributedString _isCString]: unrecognized selector sent to instance 0x8e866f0'
Any ideas on how to fix this crash?
I had to use the attributedText
property of UITextView
:
self.textView.attributedText = [array objectAtIndex:self.appDelegate.selectedCell];
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