zoukankan      html  css  js  c++  java
  • cordova 导致css中绝对定位top:0会被顶到视图之外

    • IOS7+ webview全屏导致状态栏悬浮在页面上
      解决方案:打开 ios项目/classes/MainViewController.m,修改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.  
        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];  
    } 
    

    PS:更新cordova-plugin-statusbar插件为2.2.3之后,好像失效了
    暂时把配置项改成这样

      <preference name="StatusBarStyle" value="defaults" />
    
    • ios聚焦打开键盘时,webview没有收缩高度,导致css中绝对定位top:0会被顶到视图之外
      解决方案:添加cordova-plugin-keyboard插件,然后js调用插件的方法,使开启键盘时收缩webview
    // 安装cordova-plugin-keyboard
    cordova plugin add cordova-plugin-keyboard
    

    然后在deviceready事件中调用全局Keyboard.shrinkView方法

    document.addEventListener('deviceready', () => {
      window.Keyboard.shrinkView(true);
      // 其他代码
      ...............
    }
    
    • ios自动聚焦无效(例如 autofocus、jq的$(xxx).focus())
      解决方案:在cordova配置文件config.xml中增加以下配置:
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    

    持续更新,暂时 只碰到 || 只想起 这几个



    作者:kamifun
    链接:https://www.jianshu.com/p/bf4b0a5d459a
    來源:简书
    简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
  • 相关阅读:
    MFC下使用Mysql
    Curl的移植编译以及注意事项
    MFC 封装类为静态链接库
    MFC 任务托盘显示气泡
    MFC 获取本机IP、网络ip和物理地址
    MFC下获取系统内存和当前进程的内存使用情况
    C++ windows客户端支持SSL双向认证
    jdk+tomcat+mysql一键安装脚本
    mysql修改数据库密码
    MFC 任务托盘经常消失问题
  • 原文地址:https://www.cnblogs.com/zzsdream/p/10041953.html
Copyright © 2011-2022 走看看