码迷,mamicode.com
首页 > 移动开发 > 详细

IOS截取快照

时间:2015-06-16 16:17:55      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

+ (UIImage *)takeSnapshotOfView:(UIView *)view

{

    CGFloat reductionFactor = 1;

    UIGraphicsBeginImageContext(CGSizeMake(view.frame.size.width/reductionFactor, view.frame.size.height/reductionFactor));

    [view drawViewHierarchyInRect:CGRectMake(0, 0, view.frame.size.width/reductionFactor, view.frame.size.height/reductionFactor) afterScreenUpdates:YES];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return image;

}

IOS截取快照

标签:

原文地址:http://www.cnblogs.com/417460188dy/p/4580920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!