ios - Does a width of 44 pixels equate to the same physical size for all devices? -
i work based on screen size of iphone 6 1136x750 pixels @ 326 ppi. i'm more concerned physical size of buttons (for reason) rather digital sizes.
if button has width of 44 pixels on iphone 6 , physical width of 0.2 inches has same physical width on iphone 6 plus 401 ppi?
if not, isn't supposed violate apple's guidelines? had tested 44 pixels minimum width, bigger ppi same width decreases physically.
is adjusted/scaled somehow?
edit: have feeling i'm being stupid , obvious.
edit 2: original concern across screen iphone 6 can have total of
t = 375.0 / 44.0 = 8 buttons.
while iphone 6 plus can have total of
t' = 540.0 / 44.0 = 12 buttons each button being physically smaller.
the way fix figuring out adjusted width of buttons iphone 6 plus w' = 44.0 px * 401 ppi / 326 ppi = 54.0 pixels.
so, each button on iphone 6 plus should have width of 54 pixels of same physical size.
am thinking correct?
you're right math, points in ios has nothing 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 guarantee same physical size need calculate manually each device, not best practice anyway.
from above formula 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 getting ppi programmatically:
edit:
i still recommend thinking in terms of points, not in terms of physical screen size.
Comments
Post a Comment