2011-03-31 43 views
0

我從imagepickercontroller中選擇圖像,並在imageview中進行雙擊,但對於從相機拍攝的圖像,它們總是出現在設備左側90.對於我在模擬器他們有正確的方向如何糾正this.should我指定任何方向的圖像在imageview中圖像的方向在設備中左移90左右

+0

請嘗試以下鏈接中的代碼。 http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app/538064#538064 – EmptyStack 2011-03-31 13:24:48

+0

感謝您的link.this解決了我的問題。 – sujith1406 2011-04-01 10:04:42

回答

1

我碰到了同樣的問題,我自己。我解決這個問題的方法是檢查圖像的方向,然後旋轉它,如果它應該是風景。

我使用的代碼是:

float orientation = [[myPhotoAsset valueForProperty:@"ALAssetPropertyOrientation"] floatValue]; 

if (orientation == 3) 
    photo = [self CGImageRotatedByAngle:photo angle:-90]; 

乾杯

+0

但我沒有使用alassets frmwrk.i使用uiimagepickercontroller。 – sujith1406 2011-04-01 10:04:02

0

我有同樣的問題,但最後我用下面的代碼解決了這個問題:

的UIImage *圖像= [UIImage的imageWithCGImage: [asset defaultRepresentation] fullScreenImage]];