无法使用nscoding协议来实现,只能将图片写入到doucment里面,使用UIImagePNGRepresentation()方法,将图片转化为nsdata,然后使用[data writeToFile:filePath atomically:YES];写入图片库。
归档:
UIImage *bImg = [UIImage imageNamed:KBASKETBALLNAME]; [UIImagePNGRepresentation(bImg) writeToFile:filePath atomically:YES];
解档:
UIImage *img = [UIImage imageWithContentsOfFile:path];
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #401082} span.s1 {color: #000000} span.s2 {color: #851964}
本文介绍了在iOS应用开发中如何使用UIImagePNGRepresentation方法将图片转换为NSData,并将其保存到Documents目录下。此外,还提供了从文件路径读取图片的方法。
1189

被折叠的 条评论
为什么被折叠?



