mirror of
https://github.com/apache/cordova-plugin-splashscreen.git
synced 2026-05-03 00:00:03 +08:00
CB-3562: Disable screen rotation for iPhone when splash screen is shown. (closes #47)
This is a port of emarashliev's original fix for CB-3562, cleaned up to avoid deprecated functions. Merge branch 'master' of https://github.com/emarashliev/cordova-plugin-splashscreen into CB3562 Signed-off-by: Shazron Abdullah <shazron@apache.org>
This commit is contained in:
committed by
Shazron Abdullah
parent
87f3c3a3ac
commit
52c025bbef
@@ -20,6 +20,7 @@
|
||||
#import "CDVSplashScreen.h"
|
||||
#import <Cordova/CDVViewController.h>
|
||||
#import <Cordova/CDVScreenOrientationDelegate.h>
|
||||
#import "CDVViewController+SplashScreen.h"
|
||||
|
||||
#define kSplashScreenDurationDefault 0.25f
|
||||
|
||||
@@ -68,6 +69,16 @@
|
||||
* gray = UIActivityIndicatorViewStyleGray
|
||||
*
|
||||
*/
|
||||
|
||||
// Determine whether rotation should be enabled for this device
|
||||
// Per iOS HIG, landscape is only supported on iPad and iPhone 6+
|
||||
CDV_iOSDevice device = [self getCurrentDevice];
|
||||
BOOL autorotateValue = (device.iPad || device.iPhone6Plus) ?
|
||||
[(CDVViewController *)self.viewController shouldAutorotateDefaultValue] :
|
||||
NO;
|
||||
|
||||
[(CDVViewController *)self.viewController setEnabledAutorotation:autorotateValue];
|
||||
|
||||
NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
|
||||
UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
|
||||
|
||||
@@ -107,6 +118,8 @@
|
||||
|
||||
- (void)destroyViews
|
||||
{
|
||||
[(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController *)self.viewController shouldAutorotateDefaultValue]];
|
||||
|
||||
[_imageView removeFromSuperview];
|
||||
[_activityView removeFromSuperview];
|
||||
_imageView = nil;
|
||||
|
||||
Reference in New Issue
Block a user