1.保存图片的简单方法
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[NSData writeToFile: imagePath atomically:YES];保存起来,启动时再读出就OK了
UIImage *_image = [[UIImage alloc]initWithContentsOfFile: imagePath];
2.缩放图片方法
给一个用于缩放图片的方法,计算好要缩放的大小,然后用如下方式重绘并保存:
UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸
[sourceImage drawInRect:newImageRect]; //newImageRect指定了图片绘制区域
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
OK,newImage 就是你要的图。