Search code examples
iphoneobjective-ciosipad

Draw a percentage of a circle


I would like to draw a circle like those in the picture in objective-c :

Heberger image
(source: hostingpics.net)

I just want to draw the blue circle filled with the corresponding percentage starting from the bottom. (NB : the range of the percentage is between 0 and 100) Don't worry about the tick in the center, it's just an imageView added over the circle view.


Solution

  • You could make 2 image views. One would contain your circle with the check mark, and the rest transparent. The other image would be below that, with a light blue rectangle. As the percentage increases, you raise the blue rectangle more and more by modifying it's frame. It would be visible of course through the transparent part of the image on top.

    Hope this helps!