I use swiftui to build apps on iPhone and iPad.
There is no problem with the iPhone app.
The game display is fully shown on iPhone.
However, for the iPad, the game display is not shown and the screen goes black.
I had to tap the button on the upper left side.(looks like a side view button)
After that, the game display is only shown in the left side in a very small size.
How can I make the game display fully shown in the iPad?
Could you show some code, specially the main file.
like this
I'vebeen asking Claude AI but it doesnt help me well
ZStack { // スマホ本体 - iPadでは適切なサイズに調整 Image("body") .resizable() .aspectRatio(contentMode: .fit) .frame(height: isIPad ? min(screenHeight * 0.85, screenWidth * 1.6) : screenHeight) .position( x: screenWidth / 2, y: screenHeight / 2 )
// スマホ内のコンテンツ VStack(spacing: 0) { // キャラクター表示エリア ZStack { CharacterView( characterName: getCurrentCharacterName(), frameIndex: animationFrame, totalFrames: getFrameCount() ) .frame( height: isIPad ? min(screenHeight * 0.28, screenWidth * 0.4) : screenHeight * 0.25 ) } .frame( height: isIPad ? min(screenHeight * 0.32, screenWidth * 0.45) : screenHeight * 0.3 ) .padding(.top, isIPad ? min(screenHeight * 0.08, screenWidth * 0.12) : screenHeight * 0.1) Spacer() .frame(height: isIPad ? min(screenHeight * 0.01, 10) : 1) // 機能ボタンエリア(電話・モード切替) HStack { Spacer() // 電話ボタン Button(action: { analyticsManager.logButtonTap(name: "call_button_tap") playCallSound() animateCurrentCharacter() }) { Image("btn_call") .resizable() .aspectRatio(contentMode: .fit) .frame( width: isIPad ? min(screenWidth * 0.14, screenHeight * 0.1) : screenWidth * 0.32 ) } .buttonStyle(PlainButtonStyle()) // モード切替ボタン Button(action: { switchMode() }) { Image(getModeButtonImage()) .resizable() .aspectRatio(contentMode: .fit) .frame( width: isIPad ? min(screenWidth * 0.14, screenHeight * 0.1) : screenWidth * 0.32 ) } .buttonStyle(PlainButtonStyle()) Spacer() } Spacer() .frame(height: isIPad ? min(screenHeight * 0.02, screenWidth * 0.03) : 5) // キャラクターグリッド VStack(spacing: isIPad ? min(screenHeight * 0.01, screenWidth * 0.015) : screenHeight * 0.001) { ForEach(0..<3) { row in HStack(spacing: isIPad ? min(screenWidth * 0.01, screenHeight * 0.015) : screenWidth * 0.002) { ForEach(0..<3) { col in let index = row * 3 + col CharacterButtonView( index: index, currentMode: currentMode, size: isIPad ? min(screenWidth * 0.1, screenHeight * 0.07) : screenWidth * 0.22, action: { selectCharacter(index) } ) } } } } .padding(.horizontal, isIPad ? min(screenWidth * 0.04, screenHeight * 0.03) : screenWidth * 0.05) Spacer() } .frame( width: isIPad ? min(screenWidth * 0.4, screenHeight * 0.7) : screenWidth * 0.8, height: isIPad ? min(screenHeight * 0.8, screenWidth * 1.4) : screenHeight * 0.8 ) .position( x: screenWidth / 2, y: screenHeight / 2 ) // パワーボタン - iPadでは適切な位置に配置 Button(action: { analyticsManager.logButtonTap(name: "power_button_tap") MusicPlayer.shared.playSE(sound: "buttonTap", type: "mp3") let generator = UIImpactFeedbackGenerator(style: .heavy) generator.impactOccurred() DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { generator.impactOccurred() } DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { generator.impactOccurred() } if currentCharacter >= 0 { animateCurrentCharacter() } }) { Image("pow_btn") .resizable() .aspectRatio(contentMode: .fit) .frame( width: isIPad ? min(screenWidth * 0.12, screenHeight * 0.08) : screenWidth * 0.3 ) } .contentShape(Rectangle()) .buttonStyle(PlainButtonStyle()) .position( x: screenWidth * 0.5, y: isIPad ? screenHeight * 0.08 : screenHeight * 0.06 ) // 設定ボタン - iPadでは適切な位置に配置 Button(action: { withAnimation(.spring()) { isShowingParentalControl = true passedParentalControl = false } }) { Image("setting") .resizable() .aspectRatio(contentMode: .fit) .frame( width: isIPad ? min(screenWidth * 0.06, screenHeight * 0.04) : screenWidth * 0.13 ) } .contentShape(Rectangle()) .buttonStyle(PlainButtonStyle()) .position( x: screenWidth * 0.85, y: isIPad ? screenHeight * 0.08 : screenHeight * 0.06 ) }