NSData *imageData = [NSData dataWithContentsOfFile: imagePath];
UIImage *aimage = [UIImage imageWithData: imageData];
//UIImage-> NSData
NSData *imageData = UIImagePNGRepresentation(aimae);
UIImage *aimage = [UIImage imageWithData: imageData];
//UIImage-> NSData
NSData *imageData = UIImagePNGRepresentation(aimae);
本文介绍如何使用Objective-C进行UIImage和NSData之间的相互转换。通过示例代码展示了从文件路径读取图片数据,将其转换为UIImage,再将UIImage转换回NSData的过程。
862

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



