Drawing graphics by overriding drawRect
is not very performant, because all the drawing routines are executed on the CPU. Offloading the graphics drawing to the GPU is both more performant and more power efficient.
iOS has a concept of layers, which are Core Graphics optimized drawing contents. Operations composed on a layer, including adding a path, can be translated into code that can execute on the GPU and be rendered efficiently. In addition, Core Animation can be used to animate changes on layers efficiently.
Note
Core Animation is provided in the QuartzCore framework/module; the two terms are interchangeable. It is more generally known as Core Animation.
The download progress icon on iOS can be recreated as a ProgressView
containing layers for the circular outline, a layer for the square stop button in the middle, and a layer for the progress arc. The final view will composite these three layers together to provide the finished view.
Every UIView
has an implicit...