The easiest way to change the font of a UILabel is to use the default iPhone system font. There are three different methods you can use:

UILabel *myLabel = [[UILabel alloc] init];

// sets the font to 10pt regular system font
myLabel.font = [UIFont systemFontOfSize:10];

// sets the font to 10pt bold system font
myLabel.font = [UIFont boldSystemFontOfSize:10];

// sets the font to 10pt italic system font
myLabel.font = [UIFont italicSystemFontOfSize:10];

What about fonts other than the system font?

// sets the font to 10pt Helvetica
myLabel.font = [UIFont fontWithName:@”Helvetica” size:10];

The only caveat here is you need to know which fonts are available. If you try to use a non-existent font your code will thrown an exception.

Now let’s move on to changing the background color of a UILabel. You can go the easy route and choose one of the predefined colors, or you can specify your own:

// sets the background color to a predefined light gray
myLabel.backgroundColor = [UIColor lightGrayColor];

// sets the background color to a more interesting light gray
myLabel.backgroundColor = [[UIColor alloc] initWithRed:0.93 green:0.93
    blue:0.93 alpha:1.0];

When you specify your own color using the method above, each RGB value is between 0-1. If you have an RGB value that’s between 0-255 then simply divide by 255 to get the appropriate value here.