oc
UIGraphicsBeginImageContext(self.view.bounds.size);? ? //currentView 當前的view? 創(chuàng)建一個基于位圖的圖形上下文并指定大小為當前的View
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];//renderInContext呈現(xiàn)接受者及其子范圍到指定的上下文
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();//返回一個基于當前圖形上下文的圖片
UIGraphicsEndImageContext();//移除棧頂?shù)幕诋斍拔粓D的圖形上下文
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);//然后將該圖片保存到圖片庫