//保存图片到图片库
UIImage *myImage = [UIImage imageNamed:@"me.png"];
UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
// And if you wish add this selector method in code;
- (void) image:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo:(NSDictionary*)info;
//获得源图一部分
UIImage * getImagPartRect(UIImage*srcImag, CGRect rect)
{
CGImageRef sourceImageRef = [srcImag CGImage];
CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
NSData * data= UIImagePNGRepresentation(newImage);
[data writeToFile:@"/tmp/zz.png" atomically:YES];
return newImage;
}
Iphone UIImage
最新推荐文章于 2014-06-25 18:41:05 发布