make UIImage conform to the NSCopying protocol

China☆狼群 提交于 2019-12-06 06:20:22

问题


The question is quite simple, I need to have an UIImage conform to NSCopying protocol but I have absolutely no idea on where to start to achieve this.

Do you have any pointer to help me?

Thanks in advance


回答1:


- (id) copyWithZone: (NSZone *) zone
{
    return [[UIImage allocWithZone: zone] initWithCGImage: self.CGImage];
}


来源:https://stackoverflow.com/questions/2081177/make-uiimage-conform-to-the-nscopying-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!