IOS forces switching between screen and Landscape
Recently, an html5 electronic Protocol is required, which involves signatures. The Portrait screen signature is not enough. Therefore, you need to switch the screen to the landscape screen. After the signatures are signed, the signed content is returned to the box in the portrait screen, because the project is not on AppStore and only needs to be packaged with an enterprise certificate, you can use the following method to implement the screen switching function.
Bool isPortrait = true;-(IBAction) changeOri :( id) sender {if (isPortrait) {if ([[UIDevice currentDevice] respondsToSelector: @ selector (setOrientation :)]) {[[UIDevice currentDevice] performSelector: @ selector (setOrientation :) withObject: [NSNumber numberWithInteger: Unknown]; isPortrait = false ;}} else {if ([UIDevice currentDevice] respondsToSelector: @ selector (setOrientation :)]) {SEL selector = NSSelectorFromString (@ setOrientation :); NSInvocation * invocation = [NSInvocation failed: [UIDevice failed: selector]; [invocation setSelector: selector]; [invocation setTarget: [UIDevice currentDevice]; int val = UIDeviceOrientationPortrait; // starting from 2, because two parameters 0 1 have been occupied by selector and target [invocation setArgument: & val atIndex: 2]; [invocation invoke]; isPortrait = true ;}}}