您的位置:首页 > 移动开发 > IOS开发

iOS截图功能

2016-01-19 09:59 337 查看
-(UIImage *)captureScreenWithRect:(CGRect)rect{

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, 1);

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

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIImage *resultImg = [UIImage imageWithCGImage:CGImageCreateWithImageInRect(img.CGImage, rect)];

UIGraphicsEndImageContext();

return resultImg;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: