I saw this ui_orientation candy on a WWDC video, used on this context
UIImage *finalImage = [[UIImage alloc] initWithCGImage:cgimg
scale:2.0f orientation:ui_orientation([displayImage properties])];
apparently it reads the orientation of the CCImage to create the UIImage properly, but using this on my code produces this error: implicit declaration of function 'ui_orientation' is invalid in C99
Do you guys know what header should I include on my source to make this function work?
thanks.
NOTE: WWDC 2012 - lesson 510 at 25'16" ... when the UIImage is created
This is from Session 422, where they give the code
Convert the orientation property to UIImageOrientation:
UIImageOrientation ui_orientation (NSDictionary* props)
{
int o = [[props valueForKey:(id)kCGImagePropertyOrientation] intValue];
UIImageOrientation map[] = {
UIImageOrientationUp,
UIImageOrientationUp, UIImageOrientationUpMirrored,
UIImageOrientationDown, UIImageOrientationDownMirrored,
UIImageOrientationLeftMirrored, UIImageOrientationRight,
UIImageOrientationRightMirrored, UIImageOrientationLeft,
};
return map[o];
}
Here's a handy tip too: Download all the PDFs from all the WWDC sessions and keep them on your hard drive. They don't take up much space. That way when you want to find what session talks about CATransaction
or (like here) a made up function, you can use Spotlight to find the PDF, which has the session number as its title.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With