9.5 · Core Graphics, UIBezierPath and draw(_:)

Sometimes built-in views are not enough and you draw. Core Graphics turns code into pixels, and scale is the part people forget.

Mental model. Drawing is vector instructions turned into a bitmap at a given scale. Decide when it runs, how big the bitmap is, and whether you can cache it.

Custom drawing

<code>draw(_:)</code>, renderers and paths.

  1. How do you draw with Core Graphics and UIBezierPath, and how do scale and caching affect it? 9.5.1 · L3
    Inside draw(_:), UIKit has already set up a current graphics context (UIGraphicsGetCurrentContext(), a CGContext) sized and scaled for the view. You build…

More in Layout, rendering & animation