103: How to change the default font?
In 102 we saw 'Hello World'. Changing the text is dead-simple so I tried to change the font of the text. Here's how:
Open myView.h.
Change [UIFont systemFontOfSize:24] to [UIFont fontWithName:@"AmericanTypewriter" size:24]
It looks pretty simple but I spent like an hour in documentation files and Google in order to figure it out. You need to know that iOS supports specific built-in fonts. That iOS4 font list looks pretty good. Now, let's explain what we did there.
systemFontofSize assigns the default system font to our text. By replacing it with fontWithName you assign the given font to our text. Of course, by changing the number next to size (in both cases) you change the size of the font. To decorate the font (ie. Bold - Italic) you need to go through the previous list and change the font name.
You can also change the color of the text. You only have to change [[UIColor whiteColor] set]; with any desired color. For example, [[UIColor redColor] set]; will make your text red. For more available colors, check that color list. As you will see, you can also create your own color by using the "usual" RGB values.











