From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Attributed string jazz

Attributed string jazz

- [Instructor] Sometimes you need a label, to have a bold or italic word, or possibly even two fonts. Well, it has a lot more it can do. You can jazz up a label or button using attributed strings in iOS. Download and startup the XCode project I've set up for you. I've laid out a label and code, but I haven't added any text yet. We'll add the text and format it using the attributed string in the format label method. I made the string for you called text, as you can see right here, and right under that, we're gonna assign it to an NS mutable attributed string so I can make changes to it. There's both a mutable and non-mutable, and as you probably know, if you've worked with objective C before, mutables are the only ones you can make changes to, so let's go ahead and do that. Let's do a let attributed text =NSMutable. And you can see there's several of them, so be careful which one you pick, and then put attributed, and there it comes up, attributed string, and I'm just gonna do the one…

Contents