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);
}

 

posted @ 2015-12-12 11:04  Rinpe  阅读(333)  评论(0编辑  收藏  举报