码迷,mamicode.com
首页 > 移动开发 > 详细

iOS中的截屏

时间:2015-09-30 23:21:40      阅读:506      评论:1      收藏:0      [点我收藏+]

标签:

 

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UIGraphicsBeginImageContextWithOptions(self.view.frame.size, YES, 0.0);

    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage* image = UIGraphicsGetImageFromCurrentImageContext();

    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

}

 

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo

{

    NSLog(@"保存结束");

}

 

 

技术分享

iOS中的截屏

标签:

原文地址:http://www.cnblogs.com/iOS771722918/p/4850417.html

(0)
(1)
   
举报
评论 一句话评论(1
2015-10-01 17:04:14
搜藏,谢谢分享
回复
 (0)
 (0)
1条  
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!