Pixel and point in iOS

Khoa Pham
Indie Goodies
Published in
2 min readAug 23, 2018

--

Source: The emoji movie

TL;DR: Don’t use nativeScale and nativeBounds, unless you're doing some very low level stuff

What is point and pixel

From GraphicsDrawingOverview

In iOS there is a distinction between the coordinates you specify in your drawing code and the pixels of the underlying device

The purpose of using points (and the logical coordinate system) is to provide a consistent size of output that is device independent. For most purposes, the actual size of a point is irrelevant. The goal of points is to provide a relatively consistent scale that you can use in your code to specify the size and position of views and rendered content

On a standard-resolution screen, the scale factor is typically 1.0. On a high-resolution screen, the scale factor is typically 2.0

How about scale and nativeScale

From developer.apple.com/documentation/uikit/uiscreen

  • var bounds: CGRect: The bounding rectangle of the screen, measured in points.
  • var nativeBounds: CGRect: The bounding rectangle of the physical screen, measured in pixels.
  • var scale: CGFloat: The natural scale factor associated with the screen.
  • var nativeScale: CGFloat: The native scale…

--

--