O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating shapes drawn with UIBezierPath

In iOS, you can use UIBezierPath to draw vector-based paths and use these paths to create shapes. With UIBezierPath, you can draw lines, curves, ovals, ellipses, and any complex shapes by combining them with subpaths. In this section, we will see how to create paths with UIBezierPath and build shape layers to animate them.

Getting ready

In the upcoming demo, we will draw a custom circular progress bar that can be animated with a percentage given like 50%, 80%, and so on.

How to do it...

  1. Let's create a new Xcode project with the Single View Application template with the name BezierPath.
  2. The circular progress bar will consist of two layers: a fixed layer that will be added as a background for the progress bar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required