tags:

views:

4328

answers:

1

I have following code in my Application.

tmp=[[UILabel alloc] initWithFrame:label1Frame];
tmp.tag=1;
tmp.textColor=[UIColor blackColor];
[tmp setFont:[UIFont fontWithName:@"American Typewriter" size:18]];
tmp.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:tmp];
[tmp release];

Now, I need to know,

======> how to set "Typeface=bold" through code?

+3  A: 

You will need to use the name of the bold font within the family. To find out if there is a bold version of American Typewriter, try outputting [UIFont fontNamesForFamilyName:@"American Typewriter"] to the console.

In this case, you should use "American Typewriter-Bold".

devinfoley
@flashcards - no I tried your logic, but my application crashed.
sugar
Hmmm...looks like fontNamesForFamilyName is a static method on UIFont that takes in a family name. I will fix my answer now. Did you try using "AmericanTypewriter-Bold"?
devinfoley
sugar
@sagar - There is no space between "American Typewriter". I think you have put space between them.
Brij