【发布时间】:2011-12-22 20:16:10
【问题描述】:
我正在使用 colorWithPatternImage 设置 UILabel 的背景图像,但是当我将其归档时,我收到以下错误:
NSInternalInconsistencyException', reason: 'Only support RGBA or the White color space, this method is a hack.'
是这样的,我想这是一个黑客。我的问题是:是否可以将图像存档为标签背景的一部分? 我出于不同的原因将 UILabel 子类化了,我可以添加什么来将图像设置为现有子类的背景吗?
为了清楚起见,这是导致问题的代码:
NSData *viewData = [NSKeyedArchiver archivedDataWithRootObject:label];
其中 label 是具有背景图像集的 UILabel,使用 colorWithPatternImage。
干杯!
【问题讨论】:
-
请显示一些会出现此错误的代码
-
简单代码如:NSData *viewData = [NSKeyedArchiver archivedDataWithRootObject:label];如果 UILabel 的背景已使用前面提到的 colorWithPatternImage 设置。
-
您能否更新原始问题并将代码与代码块一起添加到整个代码中?
标签: ios ipad core-data serialization uilabel