Short
Does anyone know of a way to determine the physical size of an iPhone (in inches) via code?
We want to have a slightly different UI on the iPhone 6+ and any future devices that are at least as large. The complication is that these are running in non-native mode so the screen bounds are always 320x568 units for the 6+, 6 and 5's.
Long
From what I can tell there is no way to do this (and maybe this is a conscious decision by Apple)?
I can identify an iPhone 6+ via its device name (iPhone7,1) and that's fine for now, but I can only guess at how to identify future devices. For example, if there's an iPhone 7+ will that have a device name of "iPhone8,1" and will it be as large as the 6+?
Ideally, I'd just ask the device for its size (height / width) in inches and use that to decide which UI to use. Or, if I had the dpi, I could figure out inches from that.
I can't use the new size classes for this since we're doing this in a portrait UI and the 5, 6, 6+ are all "compact" in that orientation...
There are various "tricks" that might work but these seem unreliable. This includes assuming that nativeScale >= 3 or landscape size class == "regular" ==> iPhone 6+ or larger.
As things stand currently, we will probably have to default to our 5 / 6 UI for any future devices that the code doesn't recognize (until we can do an update)...
Any ideas?
Related Links:
iOS Different Font Sizes within Single Size Class for Different Devices