title: Camera images are changing the orientation automatically in iphone
body: <p>Im developing a photo app.</p>
  
  <p>Here i'm using the images from both photo library and also the images taking through camera and displaying it in a image view.</p>
  
  <p>The images from photo library is coming in correct orientation but camera images are displaying in different orientation.</p>
  
  <pre><code>  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
      NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
      NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
      NSString *imagePath = [dataPath stringByAppendingPathComponent:@"girl.jpg"];
  
      if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) {
          UIImage *image = [UIImage imageWithCGImage:[UIImage imageWithContentsOfFile:imagePath].CGImage scale:bieberImage.image.scale
                                         orientation:NO]; 
  
       //   bieberImage.transform = CGAffineTransformMakeRotation(1.57079633);
  
  
      CABasicAnimation *crossFade = [CABasicAnimation animationWithKeyPath:@"contents"];
      crossFade.duration = 3.0;
  
  
          crossFade.fromValue = (id)bieberImage.image.CGImage;
  
          crossFade.toValue = (id)image.CGImage;
  
  
  
          [self.bieberImage.layer addAnimation:crossFade forKey:@"animateContents"];
  
          }
  </code></pre>
  
  <p>Can  anyone tell me how can i correct this problem.</p>
  
  <p>Thanks in advance.</p>