Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cdub16

macrumors member
Original poster
May 30, 2008
32
0
I am trying to change the font of a title in a button.
i have tried changing it in interface builder and in my code with:

Code:
button.titleLabel.font = [UIFont fontWithName:name size:size]
but when i run my application the text always just comes up as the default
 
How have you loaded the "Chalkduster" font, have you verified the name against UIFont's fontNameForFamily, and what iOS version are you trying to test against?
 
actually i got the button thing to work i thought i had the font loaded but i didnt.

but now it isn't working for a label.

all im using is:
Code:
label.font = [UIFont fontWithName:@"chalkdust" size:36];
the "chalkdust" worked for the button, why isnt it working for a uilabel?
 
So,
Code:
button.titleLabel.font = [UIFont fontWithName:@"chalkdust" size:36];
works but
Code:
label.font = [UIFont fontWithName:@"chalkdust" size:36];
doesn't?
 
Then, that indicates a problem with your label instance variable. Tell us more about its declaration, setting, etc.
 
Last edited:
Check whether label is nil or non-nil at the time it's assigned a font. Maybe the variable isn't connected to the nib correctly, or the label.font is occurring at the wrong time.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.