iosswiftxcode

Xcode iOS simulator displays black borders on top and bottom of views


This is a fresh project created under the Game template in newest version of Xcode. The view is acting really weird, look at the image: enter image description here

Of course, there's no constraints. If I add alignment constraints and align it correctly to horizontal and vertical center, it's aligned correctly. When normal constraints are added for each side, I get Unable to simultaneously satisfy constraints.

My main problem is however these black borders. Why do they appear? (Have tried iPhone 12, 11 and SE 2 emulators)


Solution

  • The Game template does not include a LaunchScreen.storyboard -- no idea why.

    If you add one to your project and set it in the project settings:

    enter image description here

    You'll have a full-screen view as expected.