I would like to draw an arrow inside a plain disk. Or more precisely, I would like to remove the shape of an arrow from a disk (we could see through the disk where the arrow is drawn), like this one:
How can I achieve this?
UPDATE:
So far I have drawn a disk and an arrow using the following code:
// Disk
var ovalPath = UIBezierPath(ovalInRect: CGRectMake(95, 62, 23, 23))
color2.setFill()
ovalPath.fill()
// Arrow
var bezierPath = UIBezierPath()
bezierPath.moveToPoint(CGPointMake(95.5, 75.5))
bezierPath.addLineToPoint(CGPointMake(106.5, 65.5))
bezierPath.addLineToPoint(CGPointMake(117.5, 75.5))
color3.setStroke()
bezierPath.lineWidth = 1
bezierPath.stroke()
But it's not what I'm looking for as the arrow is on top of the disk, so obviously I cannot see what's behind the disk.
I think there is no need to draw such complicated shape with code, you can use
.png
assets to replace.But if you still want to draw it. Here is what I did with
CALayer
in Xcode6.3 PlaygroundUse mask, you would get the transparent arrow.
Try it yourself~