title: Correcting orientation of UIImage stored in document with lost EXIF tags
body: <p>I have encountered a similar problem to others on SO regarding the orientation of UIImages taken using the iPad camera. Essentially, I am taking a UIImage using the camera on the iPad. When I then display it, it has rotated through 90 degrees.</p>
  
  <p>From reading other questions and answers, I now understand that when the camera takes a photo it stores an EXIF tag which determines the orientation of the photo. This would normally allow all Mac and iOS apps to read this orientation data. However, I am storing my images in the documents directory as NSData (having been converted through UIImagePNGRepresentation and saving the URL in core data. I am assuming the process of doing this is causing me to lose the orientation EXIF tag so when it is retrieved it is displayed incorrectly.</p>
  
  <p>Can anyone think of a way to correct this?</p>
  
  <p>Thoughts, advice and pointers all welcome.</p>
  
  <p>Many thanks</p>