//屏幕截图
//1.开启一个图形上下文
UIGraphicsBeginImageContextWithOptions(self.view.frame.size,NO, 0.0);
//2.获取图形上下文对象
CGContextRef ctx =UIGraphicsGetCurrentContext();
//3.调用view属性layer的方法 renderIncontex 把内容绘制到图形上下文中
[self.view.layerrenderInContext:ctx];
//4.获取图片
UIImage * getImage =UIGraphicsGetImageFromCurrentImageContext();
//5.结束图形上下文
UIGraphicsEndImageContext();
//6.保存图片到相册
UIImageWriteToSavedPhotosAlbum(getImage,nil, nil, nil);
=================
UIView里面的方法:
UIView *tempView = [view snapshotViewAfterScreenUpdates:NO];