UIImage and NSCoding iOS 5.1

后端 未结 3 395
醉话见心
醉话见心 2020-12-20 22:01

Prior to iOS 5.1 if you wanted to use NSCoding protocols with UIImage you had to do something like this.

@interface UIImage (NSCoding)

-(id)initWithCoder:(N         


        
3条回答
  •  暖寄归人
    2020-12-20 22:11

    Instead of using a category on UIImage, wouldn't it be cleaner to subclass it?

    Then you could implement initWithCoder and encodeWithCoder and use UIImage's NSCoding implementation on 5.1 and your own on pre-5.1.

提交回复
热议问题