//截图功能的实现
//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.layerrenderInContext:context];
//4.把画布上显示的内容直接转成一个UIImage对象。
UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
//5.把UIImage保存到相册
UIImageWriteToSavedPhotosAlbum(image, self,@selector(image:didFinishSavingWithError:contextInfo:), NULL);
//6.关闭一个bitmapContext
UIGraphicsEndImageContext();