标签:
截取整个屏幕大小:
1 UIGraphicsBeginImageContext(self.view.bounds.size); 2 3 [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; 4 5 UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); 6 7 UIGraphicsEndImageContext(); 8 9 UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil)
截取自定义大小:
1 UIGraphicsBeginImageContext(_attributedLabel.frame.size); 2 [_attributedLabel.layer renderInContext:UIGraphicsGetCurrentContext()]; 3 UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); 4 UIGraphicsEndImageContext(); 5 UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
项目需要导入QuartzCore.framework
标签:
原文地址:http://www.cnblogs.com/suye8280/p/4307114.html