How do you reverse the mask layer for a label? I have a textLabel
, which I use as a mask for an imageView
that contains an arbitrary image as follows:
let image = UIImage(named: "someImage")
let imageView = UIImageView(image: image!)
let textLabel = UILabel()
textLabel.frame = imageView.bounds
textLabel.text = "Some text"
imageView.layer.mask = textLabel.layer
imageView.layer.masksToBounds = true
The above makes the text in textLabel
have a font colour of the imageView
as in How to mask the layer of a view by the content of another view?.
How do I reverse this so as to remove the text in textLabel
from the imageView
?