Question

I am already able to add a layer with text in it using CATextLayer. However I'm finding the way the text is presented pretty basic. I would like to write paragraphs with quotes, in bold sometimes, italic etc...

Is there a way to do it with CATextLayer?

If not, how could I manage it, especially if the text is pulled out of a database?

I would like to be able to write the following text this way for instance:

"The article was about employment. He leafed through it in an instant. His feeling of anxiety resurfaced and he closed the magazine.

-Hm…, he breathed.

-Have you been looking for work long?, asked the stranger at his side."

Thanks

Was it helpful?

Solution

You dont need rich text if all you want to do is line breaks. add a \n for a newline. So:

layer.text=@"The article was about employment. He leafed through it in an instant. His feeling of anxiety resurfaced and he closed the magazine.\n\n-Hm…, he breathed.\n\n-Have you been looking for work long?, asked the stranger at his side."

Real Rich Text isn't possible AFAIK

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top