DevPrep

All topics › UIKit

The difference between a point (pt) and a pixel (px)

Junior PRO

The gist

Relationship: 1 pt = UIScreen.scale px. On modern iPhones scale is 2 or 3 (@2x, @3x); @1x devices have long been unsupported by iOS. So a 1 pt line on a @3x screen covers 3 physical pixels, and a "one-pixel" separator is drawn with thickness 1 / scale.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store