Skip to content

Techniques for building circular progress views using Core Animation.

License

Notifications You must be signed in to change notification settings

briancoyner/Circular-Progress

Repository files navigation

Circular Progress Views

Circular progress views are used in lots of iOS apps. UIKit, though, doesn't provide a circular progress view. Therefore we look at several techniques for building a customizable circular progress view. By customizable I simply mean that we'll be able apply different styles in a "pluggable" way to alter the look based on our app's needs and the context in which the circular progress is presented.

This demo code coincides with my STL CocoaHeads talk on techniques for building circular progress views.

The demo code shows how to:

  • use Core Animation CAShapeLayers to draw content
  • use explicit animations (CABasicAnimation) to animate the content
  • use custom animatable properties on a CALayer subclass to perform custom animations
  • apply well-known design patterns to "plug-in" and composite different progress styles
  • add "sparkles" to a progress view using a CAEmitterLayer

Sample Graphs

Samples

Presentation Slides

Be sure to review the CocoaHeads presentation slides for additional notes and details.

What About strokeEnd?

You could use CAShapeLayer's strokeEnd to animate the progress "layer". However, my experience is a "choppy" animation when there are small changes to the strokeEnd property. Therefore, the sample code examines techniques for animating "arcs" using a custom layer subclass (i.e. ProgressLayer) and a custom animatable property.

Additional Repos

Releases

No releases published

Packages

No packages published