js 判断 iPhone X、iPhone XS、iPhone XS Max、iPhone XR


js 判断 iPhone X、iPhone XS、iPhone XS Max、iPhone XR

1
2
3
4
5
6
7
8
9
10
11
hasBangs(){
// iPhone X、iPhone XS
if(cc.sys.os == "iOS" && cc.view._frameSize.height == 812 && cc.view._frameSize.width == 375){
return true;
}
// iPhone XS Max、iPhone XR
if(cc.sys.os == "iOS" && cc.view._frameSize.height == 896 && cc.view._frameSize.width == 414){
return true;
}
return false;
},