I made a CALayer *sublayer
over the main view, then I added CATextLayer
over sublayer
.
Now I want to show text on the CATextLayer
by clicking a button on my main view.
How can I do this?
I made a CALayer *sublayer
over the main view, then I added CATextLayer
over sublayer
.
Now I want to show text on the CATextLayer
by clicking a button on my main view.
How can I do this?
Copyright © 2021 Jogjafile Inc.
Set the buttons action using
-[UIButton addTarget:selector:forControlEvents:]:
, then in that function set theCATextLayer
s string property to either anNSString
or anNSAttributedString
.I remind you that
CATextLayer
doesn't respect paragraph settings on attributed strings, so line height is kind of off and does not look so great.