美文网首页
【iOS】UIView转UIImage

【iOS】UIView转UIImage

作者: CoderHuangRui | 来源:发表于2016-12-29 14:32 被阅读880次
- (UIImage *)getImageFromView:(UIView *)view {
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

相关文章

网友评论

      本文标题:【iOS】UIView转UIImage

      本文链接:https://www.haomeiwen.com/subject/omnuvttx.html