zoukankan      html  css  js  c++  java
  • 适配IphoneX

    先讲一下之前的分辨率适配做法:

    Screen.fullScreen = true;
    maxScreenWidth = Screen.currentResolution.width;
    maxScreenHeight = Screen.currentResolution.height;
    //基本原理是宽度适应高度,先把h搞成720,然后按屏幕比例适配w, 如果此时w/h>16/9,缩小w适配16:9
    realH = 720;
    realW = 720 * maxScreenWidth / maxScreenHeight;
    if (maxScreenWidth / maxScreenHeight > (16/9))
    {
        realW = realH * 16 / 9;
    }
    Sreen.SetResolution(realW, realH, true);

    要适配IponeX,只需改成:

    Screen.fullScreen = true;
    maxScreenWidth = Screen.currentResolution.width;
    maxScreenHeight = Screen.currentResolution.height;
    //基本原理是宽度适应高度,先把h搞成720,然后按屏幕比例适配w, 如果此时w/h>16/9,缩小w适配16:9
    realH = 720;
    realW = 720 * maxScreenWidth / maxScreenHeight;
    if (maxScreenWidth / maxScreenHeight > (16/9))
    {
        isIphoneX = IosSdk.GetIsIphoneX();
        if (!isIphoneX)
            realW = realH * 16 / 9;
    }
    Sreen.SetResolution(realW, realH, true);

    即,对IponeX进行全屏适配即可。

  • 相关阅读:
    防火墙实践
    提高工作效率的小技巧
    网络系统参数配置
    linux 文件截取
    python (1) 还不是大全的小问题
    iptables 命令记录
    网络常用端口
    HTTP时间指标
    错误集锦
    access数据库调用
  • 原文地址:https://www.cnblogs.com/Tearix/p/7806352.html
Copyright © 2011-2022 走看看