【问题标题】:Splash Screen cut off isuue from top and bottom in phonegap+sencha touch for iphone5iphone 5 phonegap + sencha touch 顶部和底部的启动画面切断问题
【发布时间】:2013-08-31 05:37:37
【问题描述】:
我正在使用一个 phonegap+sencha 触摸应用程序。
我已经为来自 xcode 的应用程序设置了启动画面。
我还使用了不同大小的启动画面,并给出了正确的名称。
对于 iphone4,它为启动画面拍摄正确的图像,但在 iphone5 中,它以全屏显示正确的图像,但一段时间后它再次调整为 iphone4 大小的启动画面,并且在顶部和底部有一个空白区域。
是否有任何解决方案可以为 iphone5 调整此启动画面。
这里是我如何在 iphone5 中首次显示启动画面以及一段时间后显示的屏幕。
任何帮助将不胜感激。
提前致谢。
【问题讨论】:
标签:
html
extjs
cordova
sencha-touch
splash-screen
【解决方案1】:
我的ios7 4英寸显示器也有这个问题。我使用的是科尔多瓦 2.7。通过编辑 CDVSplashScreen.m 文件解决了这个问题。有一个函数叫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;}
在顶部文件中添加了此代码
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
希望这也能帮助其他观众。干杯:)