某个UIView控件单独进行截图

来源:互联网 发布:单片机原理与应用答案 编辑:程序博客网 时间:2024/05/21 22:35
/** *  某个View单独进行截图 */- (UIImage *)snapshotSingleView:(UIView *)view{    CGRect rect =  view.frame;    UIGraphicsBeginImageContext(rect.size);    CGContextRef context = UIGraphicsGetCurrentContext();    [view.layer renderInContext:context];    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();    return image;}

IOS7之后新增API支持单独截图莫个View- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates NS_AVAILABLE_IOS(7_0);

0 0
原创粉丝点击