CB-9043 Fix the ios splashscreen being deformed on orientation change
This commit is contained in:
parent
ccb3c2f453
commit
875ccbf5bc
@ -244,10 +244,47 @@
|
||||
return imageName;
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientation)getCurrentOrientation
|
||||
{
|
||||
UIInterfaceOrientation iOrientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
UIDeviceOrientation dOrientation = [UIDevice currentDevice].orientation;
|
||||
|
||||
bool landscape;
|
||||
|
||||
if (dOrientation == UIDeviceOrientationUnknown || dOrientation == UIDeviceOrientationFaceUp || dOrientation == UIDeviceOrientationFaceDown) {
|
||||
// If the device is laying down, use the UIInterfaceOrientation based on the status bar.
|
||||
landscape = UIInterfaceOrientationIsLandscape(iOrientation);
|
||||
} else {
|
||||
// If the device is not laying down, use UIDeviceOrientation.
|
||||
landscape = UIDeviceOrientationIsLandscape(dOrientation);
|
||||
|
||||
// There's a bug in iOS!!!! http://openradar.appspot.com/7216046
|
||||
// So values needs to be reversed for landscape!
|
||||
if (dOrientation == UIDeviceOrientationLandscapeLeft)
|
||||
{
|
||||
iOrientation = UIInterfaceOrientationLandscapeRight;
|
||||
}
|
||||
else if (dOrientation == UIDeviceOrientationLandscapeRight)
|
||||
{
|
||||
iOrientation = UIInterfaceOrientationLandscapeLeft;
|
||||
}
|
||||
else if (dOrientation == UIDeviceOrientationPortrait)
|
||||
{
|
||||
iOrientation = UIInterfaceOrientationPortrait;
|
||||
}
|
||||
else if (dOrientation == UIDeviceOrientationPortraitUpsideDown)
|
||||
{
|
||||
iOrientation = UIInterfaceOrientationPortraitUpsideDown;
|
||||
}
|
||||
}
|
||||
|
||||
return iOrientation;
|
||||
}
|
||||
|
||||
// Sets the view's frame and image.
|
||||
- (void)updateImage
|
||||
{
|
||||
NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
|
||||
NSString* imageName = [self getImageName:[self getCurrentOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
|
||||
|
||||
if (![imageName isEqualToString:_curImageName])
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user