- (UIImage*)convertViewToImage:(UIView*)view {
UIImage*imageRet = [[UIImage alloc] init];
//参数说明:区域大小, 是否是非透明的, 屏幕密度
UIGraphicsBeginImageContextWithOptions(view.frame.size,YES, [UIScreenmainScreen].scale);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
imageRet =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();returnimageRet;
}
网友评论