iOS UIImage masked with Label


Example

This makes image masked to the shape of the letters of the label:

Objective-C

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

Swift 3

maskImageView.mask = maskLabel
maskImageView.masksToBounds = true

Here is the result:

result