Moo*_*Cat 4 cocoa-touch uitextview nsattributedstring ios
这是我在UITextView中显示属性字符串的代码
NSMutableAttributedString *recipeString =[[NSMutableAttributedString alloc]init];
[recipeString appendAttributedString:string1];
[recipeString appendAttributedString:string2];
[array addObject:recipeString];
Run Code Online (Sandbox Code Playgroud)
这段代码在for循环中.string1并且string2是NSMutableAttributedString.
之后:
self.textView.text = [array objectAtIndex:self.appDelegate.selectedCell];
Run Code Online (Sandbox Code Playgroud)
文本视图是一个IBOutlet.
它崩溃了这个例外:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteAttributedString _isCString]: unrecognized selector sent to instance 0x8e866f0'
Run Code Online (Sandbox Code Playgroud)
有关如何修复此崩溃的任何想法?
我不得不使用以下attributedText属性UITextView:
self.textView.attributedText = [array objectAtIndex:self.appDelegate.selectedCell];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2457 次 |
| 最近记录: |