UIView转UIImage(截屏,UIGraphicsBeginImageContextWithOptions函数的使用)2021-10-27 05:11:55 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