iOS,代码截图到相册
下面这段代码可以将当前屏幕显示的内容截图放置相册中,需要导入
#import <QuartzCore/QuartzCore.h>
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.view.backgroundColor = [UIColorgreenColor];
UIWindow *screenWindow = [[UIApplication sharedApplication] keyWindow];
UIGraphicsBeginImageContext(screenWindow.frame.size);
[screenWindow.layerrenderInContext:UIGraphicsGetCurrentContext()];
UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
}