Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bold the button text in ios?

In my app I am using custom font which working perfectly fine. But I need the button text to be bold. I googled it there is only for System fonts.

Code

button.titleLabel.font = [UIFont fontWithName:@"YanaR" size:20.0]; 

Thanks for your help guys.

like image 509
vinothp Avatar asked Dec 04 '22 02:12

vinothp


2 Answers

After fontWithName you have to use boldSystemFontOfSize:

[button.titleLabel setFont:[UIFont fontWithName:@"Arial" size:13.f]];
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:13.f]];
like image 152
Ricardo Avatar answered Dec 28 '22 13:12

Ricardo


That's because fonts don't magically make themselves bold. Bold fonts are designed separately. I'm afraid there is no answer to this question, apart from thickening the stroke of the lines, which would probably be in breach of your font agreement.

like image 42
Jonathan King Avatar answered Dec 28 '22 13:12

Jonathan King