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?
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.