Booklailert Booklailert - 3 months ago 17
iOS Question

How to scale up apps in XCode for diffrent screen sizes

I'm working on an app for iPad but when I set the contrains(so it works on iPad Pro/iPad Mini) everything moved. I don't know if I set anything wrong or if it's problems with XCode, but are there a way to just like scale up/down the screen without contrains? Or how to fix the constrains problem.

(I choose all buttons and click add missing constrains)

enter image description here


IMO selecting add missing constraints is not exactly what you want. If you want your view to scale up when screen is larger, you need to set the constraints to its superview. So you just say I want it to be 10 pt from the leading edge and 15 pt from the trailing edge. By adding missing constraints Xcode probably tells the view to be xy points wide.

To set the constraints as I mentioned you need to Ctrl drag from the view to its superview and add leading constraint. Similarly for the trailing and eventually top and bottom constraints.