Cordova/Phonegap 3.4.0 iOS 7.1 - Keyboard / Web View issue

前端 未结 4 1501
说谎
说谎 2020-12-28 08:41

I\'ve been struggling with this issue for over a week now and would really appreciate any help I can get. I\'ll explain the issue as I understand it but please correct if I

相关标签:
4条回答
  • 2020-12-28 09:27

    I am experiencing somewhat similar issue. I have a cordova 3.3.0 app in combination with Sencha Touch.

    The problem I was facing before iOS 7.0 was that the title bar went beyond the top of screen when the keyboard came up. The keyboard simply used to push the whole viewport up. After a lot of search and hard work, I was able to partially fix the issue by implementing a counter animation to move the title bar down while the keyboard was rising, using the focus and blur events of the textfield.

    iOS 7.0 came as a happy surprise as it fixed this issue natively. I commented out my fix (fortunately, did not delete) and the title bar remained fixed at the top without any extra effort.

    It seems iOS 7.1 has reverted that fix (wonder why??). When I updated to iOS 7.1, the title bar issue returned and I have now no choice but to uncomment the clumsy fix. Can anybody give some better or permanent solution to fix this problem?

    0 讨论(0)
  • 2020-12-28 09:36

    It looks like Ionic has a multipart solution to this problem which includes dynamically updating the meta viewport tag depending on the device and also by hooking into the keyboard hide/show event and then using their scrolling framework to scroll the input into view.

    More info here.. http://ionicframework.com/blog/ionic-keyboard/

    This requires you to use their framework so I'm in the process of porting this over to JQuery and IScroll and I'll keep you updated on my progress.

    I also posted my experiences with the phonegap keyboard on the phonegap forum but have not had much response yet. https://groups.google.com/forum/#!topic/phonegap/LE9-lIsNT2c

    0 讨论(0)
  • 2020-12-28 09:42

    Does this solve your issue?

    Check your html meta tags for something like this:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    

    Replace it with this:

    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />
    
    0 讨论(0)
  • 2020-12-28 09:43

    A quick fix for me involved forcing the window to scroll back into position when the input looses focus:

    $("input").on('blur',function(){
    
     //set brief timeout to let window catch up
     setTimout(function(){
    
       //reposition at top left corner of screen
       window.scrollTo(0,0);
    
     },20); 
    
    });
    

    Hope that helps!

    0 讨论(0)
提交回复
热议问题