2012-10-12 29 views
0

在我的應用我已經使用在兩個位置拍攝的圖像,如何使用圖像正確連卡馬拉在reverce方向iphone拍攝的

  1. view1:Immmidiatly用/ in imageView1設置捕獲後圖片。
  2. view2重新使用imageview1.image在第二視圖中的imageView2

在第一圖像廠景圖像設置正確,即使我們採取相反的方向,

但在第二次圖像時,我們重用imageviw1.image它在反方向設置。

如何重新使用圖像?

回答

0

使用

[UIImage imageWithCGImage:iref scale:[rep scale] orientation:(UIImageOrientation)[rep orientation]]; 

實施例:

typedef void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *asset); 
typedef void (^ALAssetsLibraryAccessFailureBlock)(NSError *error); 

ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) 
{ 
    ALAssetRepresentation *rep = [myasset defaultRepresentation]; 
    CGImageRef iref = [rep fullResolutionImage]; 
    if (iref) { 

     UIImage *images = [UIImage imageWithCGImage:iref scale:[rep scale] orientation:(UIImageOrientation)[rep orientation]]; 


    }        
}; 


ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) 
{ 


};  

NSURL *asseturl = [NSURL URLWithString:@"fileURL"]; 
assetslibrary = [[ALAssetsLibrary alloc] init]; 
[assetslibrary assetForURL:asseturl 
       resultBlock:resultblock 
       failureBlock:failureblock]; 
相關問題