美文网首页
iOS获取当前屏幕截图

iOS获取当前屏幕截图

作者: JohnayXiao | 来源:发表于2018-11-12 09:34 被阅读13次
#pragma mark - 获取屏幕截图

- (UIImage *)getNormalImage:(UIView *)view {
    
    UIGraphicsBeginImageContext(CGSizeMake(XJ_ScreenWidth, XJ_ScreenHeight));
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    [view.layer renderInContext:context];
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    return image;
    
}

相关文章

网友评论

      本文标题:iOS获取当前屏幕截图

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