使用phonegap混合开发时,在ios7+的设备中会出现系统状态栏和header重合的问题,加入代码使得状态栏和我们的应用分离:
MainViewController.m
- (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.
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];
}

本文介绍了一个在PhoneGap混合应用开发中遇到的问题——iOS 7+设备上系统状态栏与应用头部重叠,并提供了一段Objective-C代码来解决此问题,通过调整WebView的高度确保状态栏与应用内容不发生重叠。

被折叠的 条评论
为什么被折叠?



