07 January 2014

From IOS 6, there is a magical tool to make beautiful and colorful words for any purpose such as representing lovely text to girlfriend/boyfriend or to relations. It is called Attributed String. In IOS 7, we can freely to reveal text in our apps with many new supports.

In almost built-in UI Components, attributed is beside text property. If we set property attributedText, the label/UITextView/… will show attributedText instead of text property. Sometimes, we tend to set text but do some extra code to convert text to attributedText to make the string be eye-catching.

Open source

Customizing Attributed Text for Label

  • TTTAttributedLabel by Mattt. A drop-in replacement for UILabel that supports attributes, data detectors, links, and more. We can use attributed string in label with many extend features included link detetors (underline and making color for URI text) or manually making URI string. Its author is also one of creators of AFNetworking - a powerful network library.

  • OHAttributedLabel by AliSoftware. This library allows us to make label text with extended attributed string. Especially, it can customize text for hashtag (#), mention (\@). Certainly, it also built link detector for emphasizing URI. Besides, there are many applications have used this library, including SoundClound, Wunderlist. See more here.

  • Nimbus Attributed Label in Nimbus. Using NSAttributedString to render rich text labels with links using CoreText.

Attributed Text Parser

  • Slash by Chris Devereux. Slash is a simple, extensible markup language for styling NSAttributedStrings. The language is similar in appearance to HTML, however the meaning of each tag is user-defined. It can be refered as a mini-parser which can extract structured text and show text as its expected tag.

Source may need when work with AttributedString

blog comments powered by Disqus