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;
}
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;
}
相关文章推荐
- xcode7接入iOS友盟分享问题处理
- iOS-全屏右滑返回手势
- iOS调用系统相册、相机 显示中文标题
- 解决静态库文件导入 找不到问题
- iOS开发push动画效果
- iOS 【Multithreading-GCD一次性代码及其在单例模式的应用】
- iOS开发Modal页面跳转动画效果
- ios 判断字符串是否为空
- iOS开发中使app获取本机通讯录的实现代码实例
- iOS开发计算距离现在时间
- iOS中的多线程 NSOperation
- iOS应用中如何声明全局变量?
- iOS开发-代理模式
- 《从零开始自学iOS》_05
- iOS 宏
- 超精密的iOS笔记.pdf
- iOS Info.plist文件
- 苹果承认iOS9.2电量显示故障 公布解决办法
- IOS shareSDK 集成引入库以及问题
- iOS程序进入后台仍运行定时器