2

I work based on the screen size of an iPhone 6 that is 1136x750 pixels at 326 ppi. I'm more concerned about the physical size of the buttons (for some reason) rather than their digital sizes.

If a button that has a width of 44 pixels on the iPhone 6 and a physical width of 0.2 inches has the same physical width on an iPhone 6 Plus that is 401 ppi?

If not, isn't this supposed to violate Apple's guidelines? They had originally tested 44 pixels to be the minimum width, but with bigger ppi the same width decreases physically.

Is this adjusted/scaled somehow?

EDIT: I have a feeling I'm being stupid and all this is obvious.

EDIT 2: My original concern was that across the screen an iPhone 6 can have a total of

T = 375.0 / 44.0 = 8 buttons.

While the iPhone 6 Plus can have a total of

T' = 540.0 / 44.0 = 12 buttons with each button being physically smaller.

The way to fix this is by figuring out the adjusted width of the buttons for the iPhone 6 Plus which is w' = 44.0 px * 401 ppi / 326 ppi = 54.0 pixels.

So, each button on the iPhone 6 Plus should have a width of 54 pixels to be of the same physical size.

Am I thinking correct?

Vulkan
  • 1,004
  • 16
  • 44

1 Answers1

2

You're right about the math, points in iOS has nothing to do with physical size.

physicalSize = points * scale / ppi

5.5" 44*3/401 ≈ 0.33 inch

4.7" 44*2/326 ≈ 0.27 inch

So in order to guarantee the same physical size you need to calculate it manually for each device, which is not the best practice anyway.

From the above formula you get this:

points = physicalSize * ppi / scale

Swift function:

func points(fromInches inches: CGFloat) -> CGFloat {
    return inches * ppi / UIScreen.main.scale
}

var ppi: CGFloat {    
    //return device ppi
}

Check this question about getting ppi programmatically:

Edit:

I would still recommend thinking in terms of points, not in terms of physical screen size.

Community
  • 1
  • 1
alexburtnik
  • 7,661
  • 4
  • 32
  • 70
  • I doubt this is true because then Apple violates its own Guidelines. – Vulkan Nov 13 '16 at 00:18
  • What exactly you doubt? – alexburtnik Nov 13 '16 at 00:23
  • A 44 points width on the original iPhone can not have a smaller physical size on the latest iPhone. They should have the exact same physical size. Apple did make a research about a certain physical size being the minimum and that happens to be 44 pixels on the original 3.5 inch iPhone at 163 ppi. So, all devices should scale in order to maintain the physical size. – Vulkan Nov 13 '16 at 00:50
  • Unless the scale makes for larger physical sizes, in that case I'm fine, Apple is fine, we all are happy. And that's what you actually calculated it's just I can't wrap my head around it and make myself to believe that a 44 points width has a larger physical size on an iPhone 6 Plus than an iPhone 6. – Vulkan Nov 13 '16 at 00:58