• 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
    來源:简书
    简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
  • 相关阅读:
    Map使用总结
    AutoReleasePool使用总结
    UIImage使用总结
    Subversion简明手册--使用hook svn
    转:MyEclipse8.6插件安装方法
    转:myeclipse 8.x 插件安装方法终极总结
    如何通过类找到对应的jar包
    关于更改MYECLIPSE JS 代码背景颜色
    win7 64位系统下 PL/SQL无法连接的问题
    Windows7(x64)下Oracle10g安装
  • 原文地址:https://www.cnblogs.com/zzsdream/p/10041953.html
Copyright © 2020-2023  润新知