1
如何輕鬆地旋轉保存在文檔目錄中的圖像文件?如何旋轉圖像文件?
我的代碼保存它:
(...)
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
NSData* imageData = UIImageJPEGRepresentation(capturedImage, 1.0);
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
[imageData writeToFile:[docDir stringByAppendingPathComponent:@"saved.jpg"] atomically:NO];
UIGraphicsEndImageContext();
這甚至不是一個真正的的OBJ -C方法..我嘗試了一些東西,但它並沒有在這種情況下旋轉任何東西。 – yosh 2011-05-20 09:33:47
這是一個容易調用的函數。但是,如果你喜歡一種方法,沒問題。我已經改變了代碼來反映這一點。 – memmons 2011-05-22 14:59:43
對不起,我之前正在檢查類似的功能代碼,並有多個語法錯誤。我之前嘗試過CGContextRotateCTM,但沒有做任何事情,稍後會嘗試解決您的問題,謝謝! – yosh 2011-05-23 08:55:26