TypeKit vs NSAttributedString - can I use TextKit as a replacement for NSAttributedString when creating styled labels?

StackOverflow https://stackoverflow.com/questions/19554903

Вопрос

I want to style a label. Nothing crazy, just some coloring, changing of font-sizes for specific words, etc. I can do this with NSAttributedString, but would it be possible/better to do in TextKit, newly introduced with iOS 7?

I've looked around, but TextKit doesn't yet have a ton of tutorials, and none seem to address this.

Это было полезно?

Решение

It should still be done with NSAttributedStrings as the parameters you've listed exactly describe the attributes of strings. NSTextStorage is a subclass of NSMutableAttributedString but it's not intended for what you want to do (I think this class might have misled you).

Using Text Kit to Draw and Manage Text contains a nice overview of Text Kit objects, I highly recommend reading it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top