Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

iOS Fonts

How do we change the font of the text displayed in the crystal ball app?

4 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

You can also change the font itself. iOS has a lot of system fonts you can check out on http://iosfonts.com/

Lets say you wanted to change the font to "Papyrus"

textLabel.font = [UIFont fontWithName:@"Papyrus" size:12.0f]; 

Hey Louis,

To change the font of an UITextLabel object, use any of this 2 lines:

<pre> labelName.font = [UIFont systemFontOfSize:18.0f]; labelName.font = [UIFont boldSystemFontOfSize:18.0f]; </pre>

Hope it helps you :)

Amit, Pavel;

Where does this code go? Is it in the .h or .m file?

Regards,

Hey Louis,

Perhaps you are new to programming. Most of the logic/code goes in the .m file, usually inside a method, in your case you can do it in - (void)viewDidLoad { }.

Also you can use custom fonts, see here how:

http://refactr.com/blog/2012/09/ios-tips-custom-fonts/

Hope it helped you :)