Xcode iOS User Interface shown differently on simulator / preview when compared to real iPhone

Hello Everyone,

I am developing a iOS app on Xcode. The issue which I am facing is that my app user interface looks different on the Xcode simultor / preview when compared the my real iPhone.

Take a look yourself -

Xcode simulator / preview:

Real iPhone:

Even though they running the same code and same device (simulator iPhone 13 Pro and real physical iPhone 13 Pro), the user interface looks different.

Here is the UI code:

import SwiftUI

struct ScreenView: View {
  var body: some View {

    NavigationView {
      ZStack {

        Color("Colorbg").edgesIgnoringSafeArea(.all)
         
        VStack {
          Image("testim")
            .resizable()
            .aspectRatio(contentMode: .fit)
           
          Spacer()
           
          NavigationLink(destination: ScreenView1.navigationBarHidden(true)) {
            Label("Test 1", systemImage: "play.fill")
              .foregroundColor(Color.white)
              .font(.system(size: 57.5))
              .padding(.all)
              .background(Color("Colorbutton"))
              .cornerRadius(20)
          } 
        
          Spacer()
           
          Label(" Test 2 ", systemImage: "play.fill")
            .foregroundColor(Color.white)
            .font(.system(size: 57.5))
            .padding(.all)
            .background(Color("Colorbutton"))
            .cornerRadius(20)
            .labelStyle(.titleOnly)
           
          Spacer()
           
          Label(" Test 3 ", systemImage: "play.fill")
            .foregroundColor(Color.white)
            .font(.system(size: 57.5))
            .padding(.all)
            .background(Color("Colorbutton"))
            .cornerRadius(20)
            .labelStyle(.titleOnly)
           
          Spacer()
           
          HStack {
            NavigationLink(destination: Home().navigationBarHidden(true), label: {
              Label("Home", systemImage: "house.fill")
                .foregroundColor(Color.white)
                .font(.system(size: 50))
                .padding()
                .background(Color("Colorbutton"))
                .cornerRadius(30)
                 
                .labelStyle(.iconOnly)
            })
            Spacer()
          }.padding(.leading)
          Spacer()
        }
      }
    }
  }
}

struct ScreenView_Previews: PreviewProvider {
  static var previews: some View {
    ScreenView()
  }
}

How can I fix this issue?

Answered by su542sa in 719659022

Hello Everyone,

this post is resolved

the problem was that the logo image which I had used was too small eg 250x400

I had then changed my logo image to 3000x4000 and it worked using .fill

Accepted Answer

Hello Everyone,

this post is resolved

the problem was that the logo image which I had used was too small eg 250x400

I had then changed my logo image to 3000x4000 and it worked using .fill

Xcode iOS User Interface shown differently on simulator / preview when compared to real iPhone
 
 
Q