ios - How to add an overlay layer to a UIImageView but not on the transparent part of the image? -
i have uiimageview:
self.princessimageview.image = uiimage(named: "princess")! now trying add coloured layer alpha of 0.3 on image. tried this:
let overlayview: uiview = uiview(frame: cgrect(x: 0, y: 0, width: self.princessimageview.frame.size.width, height: self.princessimageview.frame.size.height)) overlayview.backgroundcolor = uicolor.blue.withalphacomponent(0.3) self.princessimageview.addsubview(overlayview) but i'm getting result.
i understand of course it's because i'm setting overlay on whole view. there way can set overlay on non-transparent part of image ?
thanks help.
you need play blending modes that.
apple documentation : link


Comments
Post a Comment