iPhone Xr和iPhone Xs Max的缺口大小(以像素或点为单位)是多少?我知道他们的iPhone X,参见https://www.paintcodeapp.com/news/iphone-x-screen-demystified上的"iPhone X断线“--我相信iPhone X有相同的维度。
我试着做一个游戏,拥抱空间,直到像素。
发布于 2021-10-20 12:55:52
@prabhat-kasera
是30x209Pt
我现在明白了我的错误所在:我在两部手机上都使用了屏幕的30/2436 %。
我应该将30/1624用于iPhone Xr,30/2688用于iPhone Xs Max。
与设备无关的代码:
// Landscape
float screenRatio = 30 * ((float)UIScreen.mainScreen.scale) /
UIScreen.mainScreen.currentMode.size.width;
// Portrait
float screenRatio = 30 * ((float)UIScreen.mainScreen.scale) /
UIScreen.mainScreen.currentMode.size.height;https://stackoverflow.com/questions/53303056
复制相似问题