Saving Photos the Right Way
when doing writeImageToSavedPhotosAlbum you can't just simply take UIImageOrientation as kCGImagePropertyOrientation, and UIImageOrientation can be confusing as to what exactly is "Up"
The following snippet will help with that:
- (int) metadataOrientationForUIImageOrientation:(UIImageOrientation)orientation
{
switch (orientation) {
case UIImageOrientationUp: // home button on right
return 1;
case UIImageOrientationRight: // bottom (portrait)
return 6;
case UIImageOrientationDown: // left
return 3;
case UIImageOrientationLeft: // top
return 8;
default:
return 1;
}
}
sources:
http://stackoverflow.com/a/6699649
http://d.hatena.ne.jp/mmtootmm/20120809/1344494972
Written by Daniel Hum
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Uiimage
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#