Objective-C 截圖實(shí)現(xiàn)
作者:佚名 
  本文為大家呈現(xiàn)了一個(gè)Objective-C的截圖實(shí)現(xiàn)的方法,希望大家能夠加以利用。
 截取整個(gè)屏幕大小:
- UIGraphicsBeginImageContext(self.view.bounds.size);
 - [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
 - UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext();
 - UIGraphicsEndImageContext();
 - UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil)
 
截取自定義大?。?/p>
- UIGraphicsBeginImageContext(_attributedLabel.frame.size);
 - [_attributedLabel.layer renderInContext:UIGraphicsGetCurrentContext()];
 - UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext();
 - UIGraphicsEndImageContext();
 - UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
 
項(xiàng)目需要導(dǎo)入QuartzCore.framework
責(zé)任編輯:閆佳明 
                    來(lái)源:
                    oschina
 














 
 
 
 
 
 
 