Anthony Shintoluggenprog Anthony Shintoluggenprog - 18 days ago 7
iOS Question

How many iOS devices should I take into account for window sizes (point values)?

I've been working on setting my app up for all device sizes. I'm going to hard code all the frames (through my calculations) and use

CGRect frame = [[UIScreen mainScreen] bounds];


to obtain window size in points. I've tried Auto layout, constraints, size classes (the whole nine thousand yards) and I find it useful for projects that aren't mine. I prefer my views, buttons, and labels to not be constrained to any particular x/y coordinate point unless they have to.

So, how many iPhone and iPad screen sizes do I need to account for to get this right and let users with any phone/tablet play my game?

I currently worked out all frames for 2G, 3G, 3GS, 4, 4s (320x480); 5, 5s, 6 (display zoom) (320x568); 6, 6 plus (display zoom) (375x667); 6 plus and 7 (414x736) and the app in those versions looks great so far.

I don't want to forget a device and end up getting denied approval for submission to app store. I've also looked for a straightforward list online for all devices and found none.

Can anyone help me out?

Answer

I went ahead and did your example to show you essentially how it could work with auto layout. Of course there are other ways to accomplish the same thing...

Imagine a circular button in the center of a 320x568 screen 60 points down from the top. When you take that button to a 375x667 screen 3 things are going to happen. The height and width will equally increase, AND the y-position of the button will increase (move down the screen). With constraint building, this scenario is (for the time being for what I can do) impossible.

I used 4 constraints

  • Button vertically aligned -114 from center (adjust as necessary)
  • Button horizontally aligned to center
  • Button aspect ratio 1:1
  • Superview width is 3.75 multiple of button (adjust as necessary) width

enter image description here

On iPhone 5

enter image description here

On iPhone 6s

enter image description here

There's a bit of an optical illusion created here because of the difference in screen size, but the button is both lowered and bigger on the iPhone 6s compared to the 5. That's what you were looking for.

Comments