Last active
December 22, 2015 20:29
-
-
Save rynbyjn/6526591 to your computer and use it in GitHub Desktop.
Category to fix PhoneGap 2.x CDVSplashScreen for updated iOS7 status bar rendering.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CDVSplashScreen+Overrides.h | |
// | |
// Created by boyajian on 9/10/13. | |
// | |
// | |
#import "CDVSplashScreen.h" | |
@interface CDVSplashScreen (Overrides) | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CDVSplashScreen+Overrides.m | |
// | |
// Created by boyajian on 9/10/13. | |
// | |
// | |
#import "CDVSplashScreen+Overrides.h" | |
@implementation CDVSplashScreen (Overrides) | |
- (void)updateBounds | |
{ | |
UIImage* img = _imageView.image; | |
CGRect imgBounds = CGRectMake(0, 0, img.size.width, img.size.height); | |
CGRect viewBounds = self.viewController.view.bounds; | |
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height; | |
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height; | |
// This matches the behaviour of the native splash screen. | |
CGFloat ratio; | |
if (viewAspect > imgAspect) { | |
ratio = viewBounds.size.width / imgBounds.size.width; | |
} else { | |
ratio = viewBounds.size.height / imgBounds.size.height; | |
} | |
imgBounds.size.height *= ratio; | |
imgBounds.size.width *= ratio; | |
_imageView.frame = imgBounds; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment