oc截屏

来源:互联网 发布:天猫就是淘宝吗 编辑:程序博客网 时间:2024/06/06 03:13
 // 开启上下文    UIGraphicsBeginImageContextWithOptions(_paintView.bounds.size, NO, 0.0);    // 获取当前上下文    CGContextRef ctx = UIGraphicsGetCurrentContext();    // 把画板上的内容渲染到上下文    [_paintView.layer renderInContext:ctx];    // 获取新的图片    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();    // 关闭上下文    UIGraphicsEndImageContext();