view转换image

来源:互联网 发布:网络开设赌场罪辩护词 编辑:程序博客网 时间:2024/06/05 23:58

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

{

    //UIGraphicsBeginImageContext(theView.bounds.size);

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

    [theView.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *image=UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return image;

}


0 0
原创粉丝点击