iOS截屏

来源:互联网 发布:2017编程语言薪资 编辑:程序博客网 时间:2024/06/10 09:45
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);CGContextRef context = UIGraphicsGetCurrentContext();[view.layer renderInContext:context]; // 截取的视图图层UIImage *image = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();


UIGraphicsBeginImageContextWithOptions

第一个参数:需要截取的尺寸大小

第二个参数:是否为不透明的

第三个参数:位图的比例因子,如果设为0.0则指定为设备主屏幕的比例因子

原创粉丝点击