Draw and fill custom shapes

0 votes
asked Mar 4, 2013 by bloonstowerdefence

I have a UIImageView that houses the picture of a floorplan. On top of that I have a UIView where I would like to draw custom shapes (semi-transparently) over different rooms on the floor plan.

I read about UIBeizerPaths for drawing custom shapes, but wasn't able to find out if I could then fill the shape I had drawn.

Summary:

1) Can I fill shapes with color that are drawn from UIBeizerPaths?

2) IF yes, can it be semi-transparent?

3) Are there any alternatives?

1 Answer

0 votes
answered Nov 8 by russell-zahniser

Basically, you want to:

  1. Override drawRect (see for example this question)
  2. Call CGContextDrawPath (see the API here)

And yes, you should be able to use a semi-transparent color.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
...