Saving [UIColor colorWithPatternImage:image] UIColor to Core Data using NSKeyedArchiver

后端 未结 3 1159
一个人的身影
一个人的身影 2020-12-03 20:11

I\'m unable to create an NSData object from a UIColor (with a pattern) created with the factory method

[UIColor colorWithPatternImage:image]

w

3条回答
  •  旧巷少年郎
    2020-12-03 21:08

    Since UIColor implements the NSCoding protocol, you don't have to write your own transformer but can just tell Core Data to use the NSKeyedUnarchiveFromDataTransformerName transform (which is the default.)

    To my knowledge, that transform handles patterns in UIColor objects.

提交回复
热议问题