【工作随笔】iOS 屏幕截屏
2015-05-27 14:43
381 查看
iOS 屏幕截屏
1. 截取当前屏幕
2. 从view上截图
3.
1. 截取当前屏幕
UIGraphicsBeginImageContextWithOptions(CGSizeMake(screenWidth*screenScale, screenHeight*screenScale), YES, 0); //设置截屏大小 [[[[UIApplication sharedApplication] keyWindow] layer] renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); CGImageRef imageRef = viewImage.CGImage; CGRect rect = CGRectMake(0, 0, screenWidth*screenScale,screenHeight*screenScale); CGImageRef imageRefRect =CGImageCreateWithImageInRect(imageRef, rect); UIImage *sendImage = [[UIImage alloc] initWithCGImage:imageRefRect];
2. 从view上截图
UIGraphicsBeginImageContextWithOptions(CGSizeMake(150, 150), NO, 1.0); //NO,YES 控制是否透明 [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // 生成后的image
3.
相关文章推荐
- iOS屏幕截取,截屏办法
- iOS开发屏幕截屏
- iOS开发屏幕截屏,超出屏幕截屏处理
- iOS 获得指定范围内的屏幕图像(截屏)
- ios xcode真机调试获取屏幕截屏
- IOS屏幕截图---Opengl截屏
- iOS 截屏的总结,AVplayer的截屏,当前屏幕的截屏,截屏后导航栏不见的情况
- ios 屏幕截屏
- iOS开发UI篇—Quartz2D(六) 图片水印,裁剪圆边框,屏幕截图 图片截屏 图片擦除
- iOS 实现截屏效果 OC保存屏幕为图片
- ios xcode真机调试获取屏幕截屏
- iOS每日一记-------屏幕截屏的妙用
- ios-(Xib的使用) 工作随笔
- iOS捕捉屏幕截屏事件
- iOS屏幕截屏
- iOS当前屏幕截屏
- iOS中屏幕亮度与闪光灯控制详解
- IOS通过加速感应器实现手机实现手机屏幕上的足球可以来回的滚动反弹
- iOS 设备的屏幕尺寸、分辨率
- iOS --- 获取屏幕顶层的UIViewController