rotation - iOS take "homebutton + powerbutton" screenshot from rotated view is upside down -
when user makes screenshot press of homebutton , powerbutton screenshot upside down. device never autorotate. observe uideviceorientationdidchangenotification
, if in landscape, show rotated view. depending on left or right device orientation
this happens when show view rotated code
cgaffinetransform rotationtransform = cgaffinetransformidentity; rotationtransform = cgaffinetransformrotate(rotationtransform, degrees_to_radians(90)); landscape.transform = rotationtransform;
here rotation methods of viewcontroller
- (bool)shouldautorotate { return no; } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation { return no; } - (nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmaskportrait; }
i disable autorotate , force rotation:
- (void)forceorientationchange { uideviceorientation deviceorientation = [uidevice currentdevice].orientation; cgaffinetransform rotationtransform = cgaffinetransformidentity; switch (deviceorientation) { case uideviceorientationfacedown: case uideviceorientationfaceup: case uideviceorientationportrait: [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationportrait animated:no]; break; case uideviceorientationlandscapeleft: { [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft animated:no]; rotationtransform = cgaffinetransformrotate(rotationtransform, degrees_to_radians(90)); landscape.transform = rotationtransform; break; } case uideviceorientationlandscaperight: { [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscaperight animated:no]; rotationtransform = cgaffinetransformrotate(rotationtransform, degrees_to_radians(-90)); landscape.transform = rotationtransform; break; } default: break; } }
i switched uiinterfaceorientationlandscapeleft uiinterfaceorientationlandscaperight
- (void)forceorientationchange { uideviceorientation deviceorientation = [uidevice currentdevice].orientation; cgaffinetransform rotationtransform = cgaffinetransformidentity; switch (deviceorientation) { case uideviceorientationfacedown: case uideviceorientationfaceup: case uideviceorientationportrait: [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationportrait animated:no]; break; case uideviceorientationlandscapeleft: { [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscaperight animated:no]; rotationtransform = cgaffinetransformrotate(rotationtransform, degrees_to_radians(90)); landscape.transform = rotationtransform; break; } case uideviceorientationlandscaperight: { [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft animated:no]; rotationtransform = cgaffinetransformrotate(rotationtransform, degrees_to_radians(-90)); landscape.transform = rotationtransform; break; } default: break; } }
Comments
Post a Comment