I'm trying to create a UILabel mask with an animatable UIView behind it. I'm trying to use this answer How to mask the layer of a view by the content of another view? but I am not having any luck..
I've created a UIImageView, and a transparent UILabel in my nib. In in my UIView subclass I do this.
override func didMoveToSuperview() {
self.imageview.layer.mask = self.label.layer
self.imageview.layer.masksToBounds = true
I've also made sure that the two are sitting right on top of eachother. Is there anything else I should know in order to make this work? When I run the simulator both the imageview, and the uilabel are missing. What am I doing wrong?
my uilabel config
here i try doing this by using a programmatically created UILabel not added to a superview
let blah = UILabel(frame: self.asteroid.frame)
blah.text = "yo yo yo"
blah.font = UIFont(name: "Estrogen", size: 20)
self.asteroid.layer.mask = blah.layer
self.asteroid.layer.masksToBounds = true