1

I have a login layout and I want it to work universally on 4 inch, 4.7 and 5.5 inch screens.

I want everything to be as if the screen was "one" and I just made it all x% larger or bigger to stretch and fit the screen.

Tizer1000
  • 894
  • 2
  • 8
  • 19
  • What constraints are you using? Please share what you have done so far. – Adeel Miraj Aug 06 '17 at 03:11
  • You should be using proportional constraints, which do exactly what you are asking. I've also submitted an edit to remove the unnecessary commentary as the problem here is a lack of experience with the platform rather than the platform itself. – JAB Aug 06 '17 at 03:18

1 Answers1

2

Part of the challenge in doing this is that different components are adjusted in different ways to scale with screen size, as well as that there are a few ways to do some of those.

Lets look at a few:

  • You can use Autoresizing to scale a view automatically with with the size of it's superview/container (so this applies to changing from portrait to landscape). You can find this in the size inspector (if you haven't set constraints). You can see an in depth tutorial on it here. enter image description here

This let's you set both spacing and internal space based on where you place the view originally.

  • Another way is setting constraints in relationship to another view with a ratio other than 1:1. For example, you can set a constraint of your button to the superview as equal widths and edit that constraint's ratio/multiplier to 1:2 to make it 50% the size or 1:4 to make it 25% of the width, etc'.

enter image description here

Jay Mutzafi
  • 161
  • 2
  • 7