// 添加QuartzCore.framework库 #import <QuartzCore/QuartzCore.h> -(void) screenShot { // 截屏 UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image= UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // 写入到相册中 UIImageWriteToSavedPhotosAlbum(image, self, nil, nil); }