在CoreData中存储NSMutableAttributedString的简单方法 [英] Simple way to store NSMutableAttributedString in CoreData

查看:61
本文介绍了在CoreData中存储NSMutableAttributedString的简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 CoreData 中存储 NSMutableAttributedString ,但是由于某些属性而遇到问题我的 NSMutableAttributedString 中包含无法归档的Core Foundation对象。有没有一种简便的方法可以将该对象存储在CoreData中,而无需手动做一些麻烦的事情?

I'm trying to store an NSMutableAttributedString in CoreData, but am running into problems since some of the attributes of my NSMutableAttributedString contain Core Foundation objects that can't be archived. Is there an easy way to get this object to store in CoreData without having to do some messy stuff manually?

推荐答案

我开始使用 CoreText 在iOS5推出时使用,因此将Core Foundation值用作属性。但是我现在意识到,自iOS6发布以来,我现在可以使用 NSForegroundColorAttributeName NSParagraphStyleAttributeName NSFontAttributeName 等在属性字典中,并且这些键伴随有 UIColor NSMutableParagraphStyle UIFont 可以存档。

I started using CoreText when iOS5 was out, and thus used the Core Foundation values as attributes. However I now realize that since iOS6 came out, I can now use NSForegroundColorAttributeName, NSParagraphStyleAttributeName, NSFontAttributeName, etc. in the attributes dictionary, and those keys are accompanied by objects like UIColor, NSMutableParagraphStyle, and UIFont which can be archived.

这篇关于在CoreData中存储NSMutableAttributedString的简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆