UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context]; // 截取的视图图层
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIGraphicsBeginImageContextWithOptions
第一个参数:需要截取的尺寸大小第二个参数:是否为不透明的
第三个参数:位图的比例因子,如果设为0.0则指定为设备主屏幕的比例因子