2014-03-12 12 views
15

我正在使用Cordova编写聊天应用程序,聊天视图在页面底部有一个类似于iMessage的输入字段。在iOS 7.0中,单击该字段调整窗口大小,并将输入字段放在键盘上方。在iOS 7.1中,单击输入字段只是将所有内容从底部向上推,并且不调整窗口大小。位于虚拟键盘下方的iOS 7.1输入字段强制缩放焦点

我的视口设置为:

<meta name="viewport" content="user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1, target-densitydpi=device-dpi" /> 
  • 当相对于上输入定位,调整大小不会发生。但是,将输入放置得足够低以与键盘顶部对齐会导致无调整大小错误。这可以通过建立Ionic frosted glass demo和更改页脚从

    <footer class="bar bar-footer bar-frosted"><button class="button button-clear button-positive" ng-click="add()">Add Message</button></footer>

    被复制到

    <footer class="bar bar-footer bar-frosted"><input name="testInput"></footer>

    通过www/index.html的

此复制错误iOS7.1,并在iOS 7.0.x中按预期工作。我遵循建议here,但他们的线程已过时,并没有结束工作。提前感谢您的任何见解!

+0

你对cordova/phone差距“KeyboardShrinksView”偏好有什么价值? –

+0

我已经尝试了真假,它没有区别。 –

+0

试试这个吗? http://stackoverflow.com/questions/19169115/phonegap-keyboard-changes-window-height-in-ios-7 – eshortie

回答

0

编辑:Ionic在beta 4版本已经修复了这个,所以这些哈克修复不应该是必要的:)大到爱奥尼亚团队认识到问题并修复它!

我现在要做的与@ajsnaps的回答类似,请回答above。我不认为它是好的解决方案,因为它有错误(类似于在其他线程中指出的错误)。

我会试着用一些更好的东西来更新这个,当我弄明白的时候,我会把这个打开,以防有人出现更好的解决方案。

$("input").on('focus',function(){ 

//set brief timeout to let window catch up 
setTimeout(function(){ 

//pull down the message area (scrollPane) and header (titleBar) 
//works on both 3.5" and 4" screens 
$("titleBar").css('top', '215px'); 
$("scrollPane").css('top', '273px'); 

},20); 

}); 

$("input").on('blur',function(){ 

//set brief timeout to let window catch up 
setTimeout(function(){ 

//push the top back up 
$("titleBar").css('top', '0px'); 
$("scrollPane").css('top', '56px'); 

},20); 

}); 

此外,我确定在从聊天视图导航回来后标题被重置。

希望这会有所帮助!

0

有没有试过明确设置宽度?像提到here

<meta name="viewport" content="width=device-width">