NSAttributedString for iOS using Interface Builder

Most of the things that I highlighted during the last post can be built easily with Interface Builder. I tried to replicate the example I showed in that post and I was able to do 90% of it without writing a single line of code…how great is that! Let me show you how.

Erase the viewDidLoad method. Go to viewController.xib, drag a UILabel on the view, open the attributes Inspector and choose Attributed under Text (this is equivalent to instantiate a NSAttributedString object). You will be able to edit your text from there. Now, change the font, size, color, highlight, add a shadow… You only have to choose the portion of text that you want to change and do it right there. You can see it on the following figure. I added 3 UILabels and I changed its properties trying to match the example from the previous post…and it worked quite well, right?

alt text

Thrilled to share those tricks with you!

Enjoy!

Eva

iOS Consulting | INVASIVECODE

iOS Training | INVASIVECODE

(Visited 503 times, 1 visits today)