0

In my App I have used captured images in two locations,

  1. view1: Immmidiatly use/set in imageView1 after capture the image.
  2. view2: Re use imageview1.image in an imageView2 in 2nd view.

in first image view1 the image is set properly even we take in reverse direction,

But in 2nd Image when we reuse the imageviw1.image It set in reverse direction.

How to reuse the image as it is?

SysDragon
  • 9,692
  • 15
  • 60
  • 89
user1645721
  • 653
  • 2
  • 8
  • 18

1 Answers1

0

use

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

Example:

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];
SysDragon
  • 9,692
  • 15
  • 60
  • 89
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102