mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-05-05 01:32:59 +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>
|
#import <Cordova/CDVViewController.h>
|
||||||
|
|
||||||
@interface CDVOrientation : CDVPlugin
|
@interface CDVOrientation : CDVPlugin
|
||||||
{}
|
{
|
||||||
|
@protected
|
||||||
|
UIInterfaceOrientation _lastOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)screenOrientation:(CDVInvokedUrlCommand *)command;
|
- (void)screenOrientation:(CDVInvokedUrlCommand *)command;
|
||||||
|
|
||||||
|
@ -55,17 +55,25 @@
|
|||||||
|
|
||||||
if ([UIDevice currentDevice] != nil){
|
if ([UIDevice currentDevice] != nil){
|
||||||
NSNumber *value = nil;
|
NSNumber *value = nil;
|
||||||
if(orientationMask == 8 || orientationMask == 12) {
|
if (orientationMask != 15) {
|
||||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
|
_lastOrientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||||
} else if (orientationMask == 4){
|
if(orientationMask == 8 || orientationMask == 12) {
|
||||||
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
|
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
|
||||||
} else if (orientationMask == 1 || orientationMask == 3) {
|
} else if (orientationMask == 4){
|
||||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
|
value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
|
||||||
} else if (orientationMask == 2) {
|
} else if (orientationMask == 1 || orientationMask == 3) {
|
||||||
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
|
value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
|
||||||
|
} else if (orientationMask == 2) {
|
||||||
|
value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_lastOrientation != nil) {
|
||||||
|
value = [NSNumber numberWithInt:_lastOrientation];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (value != nil) {
|
if (value != nil) {
|
||||||
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
|
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
|
||||||
|
[UINavigationController attemptRotationToDeviceOrientation];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user