UIImage masked with Label

suggest change

This masks the image to the shape of the label’s letters. Only the non-transparent parts of the mask show the image, so the label needs a clear background and an opaque text color. The Objective-C code uses the label’s layer as the mask, which removes that layer from the label:

Objective-C

self.maskImage.layer.mask = self.maskLabel.layer;
self.maskImage.layer.masksToBounds = YES;

Swift 3

maskImageView.mask = maskLabel
maskImageView.layer.masksToBounds = true

Here is the result:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents