0

I'm using this code here to create a view with a transparent area.

https://github.com/heigong/PartialTransparentMaskView/blob/master/src/PartialTransparentMaskView.swift

The issue is that the intersection is black even though the colour is set to UIColor.clearColour()

My code for creating this view is below

let view = PartialTransparentMaskView(frame: self.view.bounds, backgroundColor: UIColor.blueColor(), transparentRects: [self.testView.frame], transparentCircles: nil)
self.view.addSubview(view)

How this looks is also below

Image

The area in the black is set to UIColor.clearColor() so I genuinely have no idea why it would be appearing black.

Any help would be appreciated thanks.

Alex Catchpole
  • 7,156
  • 6
  • 20
  • 29
  • 1
    Because the view is `opaque`, probably. But I don't know this third party code you're using, and punching a hole in a view is so easy that I wouldn't use one. – matt Dec 06 '15 at 19:03
  • The super view or ```let view```? – Alex Catchpole Dec 06 '15 at 19:04
  • 1
    Sorry, I don't know because that's not how I would do it. I would just put a mask on the view. – matt Dec 06 '15 at 19:06
  • I tried to use masks originally but I couldn't get the effect I was going for. Would you possibly know how I could achieve this effect by setting the mask? – Alex Catchpole Dec 06 '15 at 19:06
  • 1
    What is the desired "effect"? Just punch a rectangular hole? Look up terms like "mask" and "hole". See for example my answer here http://stackoverflow.com/a/23452614/341994 And see my book if you don't know what a mask is: http://www.apeth.com/iOSBook/ch16.html#_shadows_borders_and_more – matt Dec 06 '15 at 19:52

0 Answers0