I can't seem to modify the font size of a UILabel with the following code:
itemTitle.font = [UIFont systemFontOfSize:25];
As i increase the number 25 to something greater, it seems to only add a top margin to the label, which consequently pushes the text down so much, so that the text gets cut off at the bottom or completely overflows.
i have another UILabel elsewhere with systemFontOfSize 25, and it's much smaller than the itemTitle text. What's going on? Isn't 25 supposed to be an absolute value?
i am so confused on how to programmatically change font size of uilabels.
Change Font And Size Of UILabel In StoryboardSelect the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.
I have modified the UILabel by following code:
label.font=[label.font fontWithSize:25];
Try this and see whether is it working in your case or not???
Check that your labels aren't set to automatically resize. In IB, it's called "Autoshrink" and is right beside the font setting. Programmatically, it's called adjustsFontSizeToFitWidth
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With