I need to alter specific substrings in a UILabel, using a CIFilter. A simple example might look like this:
Is there a way to access and modify (ie, use a CIFilter on) individual UILabel glyphs? Or will I need to simulate this effect by pasting together multiple one-or-more-glyph labels?
Clever answers are always appreciated.
I provided an answer for similar UILabel CIFilter type processing here:
Make emoji symbols grayscale in UILabel
There they wanted the entire label greyscale, but you could substitute the CIFilter and use the Blur Filter to blur the entire label.
Depending on how your view is laid out, you may want to break out the text before the blurred area into a separate UILabel, then the blurred UILabel, and lastly the text after the blur in a UILabel. Put them all in a UIStackView and then apply the blur only to the center label?
That may be less than ideal though depending on what you are trying to do. So the alternative is to use the code in my other answer as a starting point and then do something like this:
That is how I would chase this down, if the UIStackView approach doesn't work for you. I hope that helps.
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.