我在iPhone上正確定位圖像時出現問題。我正在使用AssetLibrary類訪問圖像。使用ALAssetOrientation和UIImageOrientation確定正確方向的問題
所有我想要做的就是正確定位顯示的圖像,不幸的是,對於某些以縱向模式拍攝的圖像,它們的方向不合理。
在那種年代由框架調用該塊,我正在爲在,而這是面向「上」採取的iPhone攝像頭的圖片下面的調用:
ALAssetRepresentation *representation = [myasset defaultRepresentation];
ALAssetOrientation orient = [representation orientation];
ALAssetOrientation alorient = [[myasset valueForProperty:@"ALAssetOrientation"] intValue];
UIImage *timg = [[UIImage alloc] initWithCGImage:[representation fullScreenImage]];
UIImageOrientation imgorient = [timg imageOrientation];
THe variable orient = ALAssetOrientationRight.
The variable alorient = ALAssetOrientationUp.
The variable imgorient = UIImageOrientationUp
我用的是定向旋轉圖像以使其看起來「向上」。不幸的是,如果我有橫向模式拍攝的圖像,則相同的代碼不起作用,因爲方向不正確。
我試過使用scale來實例化timg:orientation:使用Orient對過程參數進行過載,它所做的只是初始化設置方向但不正確旋轉圖像的圖像。
這似乎不確定性,這些電話是怎麼來返回不同的結果:
ALAssetOrientation orient = [representation orientation];
ALAssetOrientation alorient = [[myasset valueForProperty:@"ALAssetOrientation"] intValue];
您的幫助將不勝感激。
感謝, 威爾
說真的,沒有人對此發表評論?!!? – willmapp 2012-03-27 00:13:00