mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-23 16:42:50 +08:00
CB-13405: (ios) Screen unlock bug fix
This commit is contained in:
parent
63955da87b
commit
114aeef0bb
@ -24,7 +24,10 @@
|
||||
#import <Cordova/CDVViewController.h>
|
||||
|
||||
@interface CDVOrientation : CDVPlugin
|
||||
{}
|
||||
{
|
||||
@protected
|
||||
UIInterfaceOrientation _lastOrientation;
|
||||
}
|
||||
|
||||
- (void)screenOrientation:(CDVInvokedUrlCommand *)command;
|
||||
|
||||
|
@ -55,17 +55,25 @@
|
||||
|
||||
if ([UIDevice currentDevice] != nil){
|
||||
NSNumber *value = nil;
|
||||
if(orientationMask == 8 || orientationMask == 12) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
|
||||
} else if (orientationMask == 4){
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
|
||||
} else if (orientationMask == 1 || orientationMask == 3) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
|
||||
} else if (orientationMask == 2) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
|
||||
if (orientationMask != 15) {
|
||||
_lastOrientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if(orientationMask == 8 || orientationMask == 12) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
|
||||
} else if (orientationMask == 4){
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
|
||||
} else if (orientationMask == 1 || orientationMask == 3) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
|
||||
} else if (orientationMask == 2) {
|
||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
|
||||
}
|
||||
} else {
|
||||
if (_lastOrientation != nil) {
|
||||
value = [NSNumber numberWithInt:_lastOrientation];
|
||||
}
|
||||
}
|
||||
if (value != nil) {
|
||||
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
|
||||
[UINavigationController attemptRotationToDeviceOrientation];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user