iOS中截取当前屏幕,并保存图片的代码例子
UIGraphicsBeginImageContext(self.view.bounds.size); //currentView 当前的view 创建一个基于位图的图形上下文并指定大小为 [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];//renderInContext呈现接受者及其子范围到指定的上下文 UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();//返回一个基于当前图形上下文的图片 UIGraphicsEndImageContext();//移除栈顶的基于当前位图的图形上下文 UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);//然后将该图片保存到图片图
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。