我有一件最奇怪的事情--我正在使用phonegap/cordova 3.3 - ios
每次我使用正在使用显示器的插件,例如相机、视频、扫描仪,窗口显示都会缩小,并且在屏幕底部会出现一条白线。
如果我多次使用这个插件(比如拍几张照片),窗口就会变得越来越小。
这种情况在phonegap 2.9和3.3中都会发生,只在ios中发生。
发布于 2014-03-04 21:59:59
我也有同样的问题,完全一样的问题。
下面是我如何解决它的(现在它可以工作了):我恢复了以前的viewWillAppear函数/方法:
- (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];
}而是继续将另一个函数viewDidLoad更改为以下内容:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
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;
}
self.view.backgroundColor = [UIColor blackColor];
}这里的不同之处在于,viewDidLoad将只执行一次(这是您实际想要的),而viewWillAppear在每次向用户显示/呈现此视图时都会执行。
我希望这能帮到你。
发布于 2014-02-25 14:48:08
这是由我试图解决的另一个问题引起的,这里是原始问题:iOS 7 status bar overlapping UI
解决方案是按如下方式更改viewWillAppear (在MainViewController.m中)
// ios 7 status bar fix
- (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) {
if(self.webView.frame.origin.y == 0) {
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 20;
self.webView.frame = viewBounds;
}
}
[super viewWillAppear:animated];
}https://stackoverflow.com/questions/21991286
复制相似问题