opa*_*ela 2 css jquery html5 ios jquery-mobile
新的iOS7状态栏与我的应用程序的标题重叠,导航按钮部分覆盖.但是,它在iOS6中看起来很漂亮,我拒绝为iOS7添加边距/填充并打破以前版本的外观.
是否有任何干净的解决方案(类似于独家选择器)可以使它在两个系统中都有效?
我试过了什么?
正如我所说,我设法在iOS7上解决它,为标题添加了一些额外的余量(由jQueryMobile格式化),但这种变化也会影响iOS6中的视图.我确定还有其他一些我不知道的伎俩,但Google还没有给我答案.
提前致谢.
有一个简单的解决方案.它不会破坏iOS6上应用程序的外观,因为它仅适用于ios7>
您可以在MainViewController.m中使用它,查找 - (void)viewWillAppear:(BOOL)动画并添加if函数:
- (void)viewWillAppear:(BOOL)animated
{
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
//Lower screen 20px on ios 7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 20;
self.webView.frame = viewBounds;
}
[super viewWillAppear:animated];
}
Run Code Online (Sandbox Code Playgroud)
从这里:iOS 7状态栏重叠UI
function onDeviceReady() {
if (parseFloat(window.device.version) === 7.0) {
document.body.style.marginTop = "20px";
}
}
Run Code Online (Sandbox Code Playgroud)
你需要设备插件.但第二个对我不起作用.另一方面,#1就像一个魅力.