图片合成截屏
-(UIImage *)saveImage:(UIView *)view {
CGRect mainRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(CGSizeMake(320, 200));
CGContextRef context = UIGraphicsGetCurrentContext();
// [[UIColor blackColor] set];
CGContextFillRect(context, mainRect);
[view.layer renderInContext:context];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
CGRect mainRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(CGSizeMake(320, 200));
CGContextRef context = UIGraphicsGetCurrentContext();
// [[UIColor blackColor] set];
CGContextFillRect(context, mainRect);
[view.layer renderInContext:context];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
posted on 2015-12-04 17:07 taiyang2014 阅读(161) 评论(0) 编辑 收藏 举报