我使用出色的英特尔 AppFramework 作为我的 phonegap/cordova 应用程序的 UI,但从 iOS7 开始,有时当我打开键盘时,底部菜单会上升(它不应该):http://screencloud.net/v/9omt然后,当我关闭键盘时,底部菜单停留在屏幕中间:http://screencloud.net/v/DgRf
看起来错误在隐藏地址栏函数中。我禁用了该功能,现在,菜单总是上升,但至少,当我关闭键盘时,它总是完成。
(我们使用 1.0 版本。我们计划很快更新,但我们正处于紧急发布过程中)
提前感谢您的任何帮助或指示,
这个解决方案对我有用。我的索引中有以下元标记.html:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
我把它改成这样:
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />
最重要的属性是 height=device-height,它表示视图大小将始终是设备的大小。
编辑:iPad在横向和iOS7中存在错误。视口的 CSS 大小错误...
我和你在同一条船上,试图找出一个可行的解决方案。 我正在与这里的ios phoengap主要贡献者之一合作:https://issues.apache.org/jira/browse/CB-3020
他发布了一个更新的解决方案,3.1 应该很快就会推出修补的修复程序。
我仍然遇到一些问题,并且在某些页面上随机显示底部的黑条。
前往科尔多瓦吉拉网站并添加您的测试详细信息以提供帮助。
谢谢!
虽然塞缪尔的回应应该可以解决问题,但它会产生其他副作用。例如,在Phonegap 3.3中,将高度=设备高度添加到视口,您将在每个屏幕上滚动(即使页面上的元素不够大,无法使屏幕完整)。在我们的例子中,这里找到的唯一解决方案是将通知处理程序添加到 Phonegap 上的打开键盘,该处理程序调用 javascript 函数,然后隐藏此函数上的固定页脚,此外在焦点/模糊函数中再次隐藏/显示页脚。附上了一个使用 jquery mobile 的示例,但您可以更新它以使用不同的框架:
在javascript上:
$(document).on('focus','input, select, textarea',function() {
if( device.platform=== 'iOS' && parseInt(device.version.substring(0,1)) >= 7){
if($(this).attr('readonly')===undefined){
$("[data-role=footer]").hide();
}
}
});
$(document).on('blur','input, select, textarea',function(){
if( device.platform=== 'iOS' && parseInt(device.version.substring(0,1)) >= 7){
if($(this).attr('readonly')===undefined){
$("[data-role=footer]").show();
}
}
setTimeout(function() {
window.scrollTo(document.body.scrollLeft, document.body.scrollTop);
}, 0);
});
function hideFooter(){
if( device.platform=== 'iOS' && parseInt(device.version.substring(0,1)) >= 7){
if($(this).attr('readonly')===undefined) {
$("[data-role=footer]").hide();
}
}
}
在phonegap MainViewController.m中:
- (id)init
{
self = [super init];
if (self) {
// Uncomment to override the CDVCommandDelegateImpl used
// _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
// Uncomment to override the CDVCommandQueue used
// _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
}
//fix for ios7 footer is scrolled up when the keyboard popsup.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
return self;
}
-(void)keyboardWillShow:(NSNotification*)notification{
if (IsAtLeastiOSVersion(@"7.0")){
[self.webView stringByEvaluatingJavaScriptFromString:@"hideFooter()"];
}
}