UIView转UIImage(截屏,UIGraphicsBeginImageContextWithOptions函数的使用)

UIView转UIImage(截屏,UIGraphicsBeginImageContextWithOptions函数的使用)  

2012-11-06 13:56:59|  分类: iphone_dev_note|举报|字号 订阅

// 需要转成image的view:captureAndSaveView
UIGraphicsBeginImageContextWithOptions(captureAndSaveView.frame.size, NO, 1.0);  //NO,YES 控制是否透明
[captureAndSaveView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// 生成后的image
上一篇:ScrollView分析


下一篇:CGContextRef