質問編集履歴

1

判別はできたのですが、画面が縮小して表示されてしまいます。

2020/12/11 05:41

投稿

instinct
instinct

スコア28

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- プログラミング初心者です。xcode Version 12.2 を使用しています。 新しいアプリを作成しようと思い、create a new Xcode project → game → swift , SpriteKit と作成しました。GameViewController.swiftで
1
+ プログラミング初心者です。xcode Version 12.2 を使用し、iOSのターゲットは10以降にしています。新しいアプリを作成しようと思い、create a new Xcode project → game → swift , SpriteKit と作成しました。GameViewController.swiftで
2
2
 
3
3
 
4
4
 
@@ -12,15 +12,17 @@
12
12
 
13
13
 
14
14
 
15
- if (UIScreen.main.nativeBounds.height == 2532.0) {
15
+ if (UIScreen.main.nativeBounds.height == 2532.0) {
16
16
 
17
- print("iphone 12,iphone 12 pro")
17
+
18
18
 
19
+ print("iphone 12,iphone 12 pro")
19
20
 
21
+ scene.scaleMode = .aspectFit
20
22
 
21
- } else if (UIScreen.main.nativeBounds.height == 1334) {
23
+ scene.size = CGSize(width: 755, height: 1700)
22
24
 
23
- print("iPhone 6/7/8,se")
25
+
24
26
 
25
27
  }
26
28
 
@@ -32,4 +34,8 @@
32
34
 
33
35
 
34
36
 
35
- printで調べてみたら 1440.0という数字が返ってきて、調べてもわからない状態です。iphone6で調べたら960になりました。原因と解決方法を教えだきたいです。今までこやり方で判別してましたので、方法間違っいる事はないと思いす。よろしくお願いたします。
37
+ printで調べてみたら 1440.0という数字が返ってきて、調べてもわからない状態です。iphone6で調べたら960になりました。仮に iphone12のUIScreen.main.nativeBounds.height == 1440.0 でデバッグし所、iphone12の判別はできたのですが画面縮小し表示されてしまいます。
38
+
39
+
40
+
41
+ 原因と解決方法を教えていただきたいです。今までこのやり方で判別してきましたので、方法が間違っている事はないと思います。よろしくお願いいたします。