ios – UITextView中的归因文本导致崩溃

ios – UITextView中的归因文本导致崩溃,第1张

概述这是我在UITextView中显示属性字符串的代码 NSMutableAttributedString *recipeString =[[NSMutableAttributedString alloc]init]; [recipeString appendAttributedString:string1]; [recipeString appendAttributedString: 这是我在UITextVIEw中显示属性字符串的代码

NSMutableAttributedString *recipestring =[[NSMutableAttributedString alloc]init];    [recipestring appendAttributedString:string1];    [recipestring appendAttributedString:string2];    [array addobject:recipestring];

此代码位于for循环中. string1和string2是NSMutableAttributedStrings.

之后:

self.textVIEw.text = [array objectAtIndex:self.appDelegate.selectedCell];

文本视图是IBOutlet.

崩溃了这个例外:

Terminating app due to uncaught exception 'NSinvalidargumentexception',reason: '-[NSConcreteAttributedString _isCString]: unrecognized selector sent to instance 0x8e866f0'

有关如何修复此崩溃的任何想法?

解决方法 我不得不使用UITextVIEw的attributedText属性:

self.textVIEw.attributedText = [array objectAtIndex:self.appDelegate.selectedCell];
总结

以上是内存溢出为你收集整理的ios – UITextView中的归因文本导致崩溃全部内容,希望文章能够帮你解决ios – UITextView中的归因文本导致崩溃所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1076947.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存