Chris
Chris

Reputation: 811

Cropping sharp edges from behind a UIBezierPath rounded rectangle

I'm learning my way through UIBezierPaths by creating a table from scratch, and having individual cells filled with different colours.

screenshot1.png

This is a custom object I'm building which is contained in a subclassed UIView.

At the moment, I'm constructing this in this order:

  1. 'Cell' fill colours
  2. Column lines
  3. Row lines
  4. Outer box (rounded rect)

As the picture suggests, I'm having trouble getting rid of the sharp corner of the cell fill outside the orange rounded rectangle.

Can anyone point me in the right direction to get rid of these?

Cheers! :)

Upvotes: 2

Views: 546

Answers (1)

anon
anon

Reputation:

At the beginning of your drawing code you should add the outer rounded rect path to the clipping path using its addClip method. That way nothing will get drawn that is outside this path.

Upvotes: 2

Related Questions