IOS中截屏的实现,很简易的方法


// 添加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);
}
原文地址:https://www.cnblogs.com/Rinpe/p/5040945.html