设为首页 加入收藏

TOP

iOS 截屏代码
2017-10-11 13:57:16 】 浏览:3098
Tags:iOS 代码

-(UIImage*)getScreenPhoto{

    CGFloat scale = [UIScreen mainScreen].scale;

    NSMutableArray *images = [NSMutableArray array];

    

    CGSize contentSize = self.view.size;

    

    CGSize imageSize = CGSizeMake(contentSize.width * scale, contentSize.height * scale);

    

    UIGraphicsBeginImageContextWithOptions(self.view.size, NO, 0.0);

    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    [images addObject:image];

    

    UIGraphicsBeginImageContext(imageSize);

    

    [images enumerateObjectsUsingBlock:^(UIImage *image, NSUInteger idx, BOOL *stop) {

        [image drawInRect:CGRectMake(0, scale * EJScreenH * idx, EJScreenW * scale, EJScreenH * scale)];

    }];

    UIImage *fullImage = UIGraphicsGetImageFromCurrentImageContext();

    

    UIGraphicsEndImageContext();

  return fullImage;

    

}

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇iOS:UITableView相关(17-10-10.. 下一篇iOS 模拟器限速测试

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目