0

我正在使用一个 phonegap+sencha 触摸应用程序。
我已经为来自 xcode 的应用程序设置了启动画面。
我还使用了不同大小的启动画面,并给出了正确的名称。
对于 iphone4,它为启动画面拍摄正确的图像,但在 iphone5 中,它以全屏显示正确的图像,但一段时间后它再次调整为 iphone4 大小的启动画面,并且在顶部和底部有一个空白区域。
是否有任何解决方案可以为 iphone5 调整此启动画面。

以下是我如何在 iphone5 中首次显示启动画面以及一段时间后如何显示启动画面的屏幕。
首先它像这样加载 一段时间后,它设置为这样,顶部和底部的空白

任何帮助将不胜感激。
提前致谢。

4

1 回答 1

0

Me too had this problem in ios7 4inch display. I was using cordova 2.7. Solved this by editing in CDVSplashScreen.m file. There is a function named update - (void)updateBounds

- (void)updateBounds{
UIImage* img = _imageView.image;
CGRect imgBounds = CGRectMake(0, 0, img.size.width, img.size.height);

CGSize screenSize = [self.viewController.view convertRect:[UIScreen mainScreen].bounds fromView:nil].size;

// There's a special case when the image is the size of the screen.
if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
    CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
    imgBounds.origin.y -= statusFrame.size.height;
    //added this code for IOS7
    if (CDV_IsIPhone5() && SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        imgBounds.origin.y=0.0f;
    }

} else {
    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;}

Added this code on the top file

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

Hope this will help other viewers also. cheers :)

于 2013-12-10T10:10:51.353 回答