Background: The uiimagepickcontroller view is customized. The UI of the horizontal version is used to guide the user to take a horizontal screen shot,
Requirement: Make sure that the photo is always horizontal to the right when you confirm the photo
Device direction:
Typedef Enum {uideviceorientationunknown, uideviceorientationportrait, orientation, orientation, uideviceorientationlandscaperight, uideviceorientationfaceup, uideviceorientationfacedown} uideviceorientation;
Image direction
Typedef ns_enum (nsinteger, uiimageorientation ){
Uiimageorientationup, // default Orientation
Uiimageorientationdown, // 180 deg Rotation
Uiimageorientationleft, // 90 deg CCW
Uiimageorientationright, // 90 deg CW
Uiimageorientationupmirrored, // as above but image mirrored along other axis. Horizontal flip
Uiimageorientationdownmirrored, // horizontal flip
Uiimageorientationleftmirrored, // vertical flip
Uiimageorientationrightmirrored, // vertical flip
};
Key Aspect 1: The device direction may be any direction when the user sets the horizontal layout, rather than the expected horizontal layout. The device direction is derived from the result of the previous gravity sensing, moving across the mobile phone will not change the device direction. Point 2. Using Four Directions to describe the location of the 3D world mobile phone will lose part of the information, therefore, by default, the mobile phone screen is always oriented to the user. Method 1: rotate the image to change the pixel.
Transform = Cgaffinetransformtranslate(Transform, Self.Size.Width, 0);Transform = Cgaffinetransformrotate(Transform, M_pi_2);EngineeringSource code
Https://gist.github.com/alex-cellcity/1531596 2:, to change the display
Cgimageref ciimage = self. cgimage;
Uiimage * image = [[uiimage alloc] initwithcgimage: ciimage scale: 1.0 orientation: uiimageorientationup];
Uiimage Direction problems
Http://www.cnblogs.com/smileEvday/archive/2013/05/14/UIImage.html