首页 > 其他 > 详细

屏幕截图的方法

时间:2016-01-06 17:29:58      阅读:91      评论:0      收藏:0      [点我收藏+]

不用 2d截图   直接截图

 1 -(UIImage *)screenShots
 2 {
 3      //截取整个backview
 4     UIGraphicsBeginImageContext(self.backgroundView.bounds.size);
 5     [self.backgroundView.layer renderInContext:UIGraphicsGetCurrentContext()];
 6     UIImage *sourceImage = UIGraphicsGetImageFromCurrentImageContext();
 7     UIGraphicsEndImageContext();
 8 
 9 //在截图上画下自己需要的位置及大小
10     UIGraphicsBeginImageContext(self.mainContentView.frame.size);
11     [sourceImage drawAtPoint:CGPointMake(0, self.mainContentView.bounds.size.height - self.view.bounds.size.height)];13     UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
14     UIGraphicsGetCurrentContext();
15 
16        return image;
17 }

 

屏幕截图的方法

原文:http://www.cnblogs.com/jw-blog/p/5106150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!