0

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?

Wyetro
  • 8,439
  • 9
  • 46
  • 64
Sahil Mahajan
  • 3,922
  • 2
  • 29
  • 43

1 Answers1

0

Set the buttons action using -[UIButton addTarget:selector:forControlEvents:]:, then in that function set the CATextLayers string property to either an NSString or an NSAttributedString.

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.

Wyetro
  • 8,439
  • 9
  • 46
  • 64