Search code examples
iosxcodeios-simulatorscreen-resolution

Xcode iOS simulator content size not scalable


I am an absolute beginner in iOS development and Xcode. I created single view project and set the size of the view controller to an iPhone 5.5inch screen. This can be seen here:

enter image description here

But if I run this with the simulator, I cannot see the whole content in my simulator screen:

enter image description here

Even when I use cmd+2/3/... to scale the window size, this doesn't help, because the content size is also scaled to the chosen setting.

How can I fix this?


Solution

  • What you need to do is set up AutoLayout constraints. Right now you have set up UI but it's not scalable to different screen sizes and that's why you don't see whole content. AutoLayout will scale that for you. Because AutoLayout is wide topic, I will show you the simplest way to do that. All you have to do is select Add Missing Constraints(screenshot) and you are good to go. enter image description here

    Here is result: enter image description here