UIGraphicsBeginImageContext(self.view.bounds.size); //currentView 目前的view 建立一個基于位圖的圖形上下文并指定大小為
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];//renderInContext呈現接受者及其子範圍到指定的上下文
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();//傳回一個基于目前圖形上下文的圖檔
UIGraphicsEndImageContext();//移除棧頂的基于目前位圖的圖形上下文
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);//然後将該圖檔儲存到圖檔圖