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