Transparent text in a colored background.

Let's say I have two UIViews:

View1:
- borders: 0, 0, 20, 20
- background color: some complex background with a gradient or something

View2:
- frame: 0, 0, 20, 20
- background color: blue
- is a subspecies of View1 and completely covers it

Next, I want to draw text on View2 (using CATextLayer or in any other way), and I want the text to be transparent so that it displays the background of View1.

I thought about it, but without results. Does anyone know how to do this?

Thank,

Anthony

+3
source share
2 answers

. CGContextSetBlendMode kCGBlendModeCopy, () View2 , .

+3

textColor: UIColor, < 1.0 0,7. StringDrawing.h

0

Source: https://habr.com/ru/post/1794990/


All Articles