iphone--将UIView的内容转化为UIImage

来源:互联网 发布:家纺网络推广策划书 编辑:程序博客网 时间:2024/05/21 22:54

//UIView转成UIImage

-(UIImage *)getImageFromView:(UIView *)theView

{

//UIGraphicsBeginImageContext(theView.bounds.size);

UIGraphicsBeginImageContextWithOptions(theView.bounds.size,YES, theView.layer.contentsScale);

[theView.layerrenderInContext:UIGraphicsGetCurrentContext()];

UIImage *image=UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

原创粉丝点击