- //截图功能的实现
-     //1.建立一个bitmapContext
-     UIGraphicsBeginImageContext(self.view.bounds.size);
-     
-     //2.获取bitmapContext
-     CGContextRef context = UIGraphicsGetCurrentContext();
-     
-     //3.把self.view.layer图层的全部内容渲染到bitmapContext上去。
-     //截取当前图层的一部分
- UIRectClip(CGRectMake(100, 100, 200, 200));
- [self.view.layer renderInContext:context];
- //4.把画布上显示的内容直接转成一个UIImage对象。
- UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
- //5.把UIImage保存到相册
- UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
- //6.关闭一个bitmapContext
- UIGraphicsEndImageContext();
截图功能的简单实现
原文:http://www.cnblogs.com/SilverWinter/p/4423408.html