You need to assign your UILabel
as maskView of your UIVisualEfectView
and the trick is that you need add a container for your UIVisualEfectView
and your UILabel
and set the background color for this container view as UIColor.clear
self.visualEfectView.mask = self.label
self.visualEfectView.layer.masksToBounds = true
View Hierarchy Setup
Result
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.