在我的應用程序中,我有一個用戶圖像視圖與一個部分刪除疊加在另一個圖像視圖的頂部,所以用戶可以上傳從相機膠捲和操縱屏幕上的圖片。我想使用以下代碼將這兩個圖像保存在一起以拍攝屏幕。但是,因爲這樣可以沿着底部獲得頂部欄和標籤視圖,是否可以通過屏幕快照按鈕指定屏幕的某個區域進行保存?保存屏幕的一部分截圖xcode 4.2
我可以操作下面的代碼,因此它不需要整個屏幕的屏幕截圖,因此我可以省略欄按鈕嗎?
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
UIGraphicsBeginImageContextWithOptions(self.view.window.bounds.size, NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
爲什麼這被標記?這不是提出編程問題的地方嗎?也許這個標記的人會解釋一下嗎? – JSA986