スポンサーリンク
iPhone Xも発売され、対応しなければならないスクリーンサイズも増えてきました。PolyRhythmでもiPhone Xの対応をしないとな〜と思いつつ、なかなか出来てません。ここで1つおさらいしておこうと思います。
スポンサーリンク
iPhoneスクリーンサイズ一覧
以下に、UIScreen.main.boundsとUIScreen.main.nativeBoundsのサイズの一覧をデバイスごとに並べます。中のロジックはboundsで、バックグラウンドの画像とかはnativeBoundsでサイズを考えれば良いのでしょうかね。ちなみに、昔作ったKATAOMOIとかは、どのデバイスで値をとってもiPhone 5sと同じ値が返ってきます。互換モード的なノリになってるのでしょうかね。iPhone 6s等でアプリを立ち上げるとステータスバーが急に大きくなるので、ちょっと違和感を感じます。以下の値は新規にプロジェクトを起こして、空の状態で採取しています。
- iPhone 5s、iPhone SE
UIScreen.main.bounds.size.height : 568.0
UIScreen.main.bounds.size.width : 320.0
UIScreen.main.nativeBounds.size.height : 1136.0
UIScreen.main.nativeBounds.size.width : 640.0
- iPhone 6、iPhone 6s、iPhone 7、iPhone 8
UIScreen.main.bounds.size.height : 667.0
UIScreen.main.bounds.size.width : 375.0
UIScreen.main.nativeBounds.size.height : 1334.0
UIScreen.main.nativeBounds.size.width : 750.0
- iPhone 6 Plus、iPhone 6s Plus, iPhone 7 Plus, iPhone 8 Plus
UIScreen.main.bounds.size.height : 736.0
UIScreen.main.bounds.size.width : 414.0
UIScreen.main.nativeBounds.size.height : 2208.0
UIScreen.main.nativeBounds.size.width : 1242.0
- iPhone X
UIScreen.main.bounds.size.height : 812.0
UIScreen.main.bounds.size.width : 375.0
UIScreen.main.nativeBounds.size.height : 2436.0
UIScreen.main.nativeBounds.size.width : 1125.0
スポンサーリンク
スポンサーリンク