关于新手机的适配---之启动图尺寸

2020-06-02  本文已影响0人  adalillian

https://www.jianshu.com/p/e583b059d6fd


#define iphone4(XMGScreenH == 480)      //4,4s

#define iphone5(XMGScreenH == 568)      //5,5s,5c,5se

#define iphone6(XMGScreenH == 667)      //6,6s,7,8

#define iphone6P(XMGScreenH == 736)  //6p,6sp,7p,8p

#define iphoneX(XMGScreenH == 812)    //x,xs

    if(iphone4){ 

        self.launchImageView.image =[UIImage imageNamed:@"启动页iPhonePortraitiOS56_320x480pt@2x"];

    } 

    else if(iphone5){ 

        self.launchImageView.image =[UIImage imageNamed:@"启动页iPhonePortraitiOS56_320x568pt@2x"];

    }

    else if(iphone6){ 

        self.launchImageView.image =[UIImage imageNamed:@"启动页iPhonePortraitiOS89_375x667pt@2x "];

    }

     else if(iphone6P){ 

        self.launchImageView.image =[UIImage imageNamed:@"启动页iPhonePortraitiOS89_414x736pt@3x"];

    } 

    else if(iphoneX){ 

        self.launchImageView.image =[UIImage imageNamed:@"启动页iPhoneXPortraitiOS11_375x812pt@3x "];

    } 



#define XMGScreenW[UIScreen mainScreen].bounds.size.width

#define XMGScreenH[UIScreen mainScreen].bounds.size.height

#define iphone6P(XMGScreenH == 736)

#define iphone6(XMGScreenH == 667)

#define iphone5(XMGScreenH == 568)

#define iphone4(XMGScreenH == 480)

    // 6p:LaunchImage-800-Portrait-736h@3x.png

    // 6:LaunchImage-800-667h@2x.png

    // 5:LaunchImage-568h@2x.png

    // 4s:LaunchImage@2x.png

    if(iphone6P){ // 6p

        self.launchImageView.image =[UIImage imageNamed:@"LaunchImage-800-Portrait-736h@3x"];

    } else if(iphone6){ // 6

        self.launchImageView.image =[UIImage imageNamed:@"LaunchImage-800-667h"];

    } else if(iphone5){ // 5

        self.launchImageView.image =[UIImage imageNamed:@"LaunchImage-568h"];

    } else if(iphone4){ // 4

        self.launchImageView.image =[UIImage imageNamed:@"LaunchImage-700"];

    }

#define iphoneXR  (XMGScreenH == 896 &&  XMGScreenW == 414)  //xr

#define iphoneXSMax  (XMGScreenH == 896  &&  XMGScreenW == 375)  //xsMax


上一篇下一篇

猜你喜欢

热点阅读