读书人

iphone程序中兑现截屏的一种方法

发布时间: 2012-07-30 16:19:05 作者: rapoo

iphone程序中实现截屏的一种方法

//导入头文件#import QuartzCore/QuartzCore.h//将整个self.view大小的图层形式创建一张图片image UIGraphicsBeginImageContext(self.view.bounds.size);[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];UIImage*image=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();//然后将该图片保存到图片图UIImageWriteToSavedPhotosAlbum(image,self,nil,nil);

读书人网 >Iphone

热点推荐