How to highlight button text in ios?

In my application, I use my own font, which works great. But I need the button text to be bold. I googled it is only for system fonts.

code

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

Thanks for helping the guys.

+4
source share
5 answers

This is because fonts do not magically make themselves bold. Bold fonts are developed separately. I am afraid there is no answer to this question other than a thickening of the dashed lines, which is likely to violate your font agreement.

+4
source

After fontWithName you should use boldSystemFontOfSize:

 [button.titleLabel setFont:[UIFont fontWithName:@"Arial" size:13.f]]; [button.titleLabel setFont:[UIFont boldSystemFontOfSize:13.f]]; 
+8
source

You will also need to add a bold version of the font that you use, if available. This is a completely separate font. If it is available, after you enable it, install it the same way you try, but use the bold font name instead.

eg:

 button.titleLabel.font = [UIFont fontWithName:@"YanaR-Bold" size:20.0]; 
+3
source

Not sure about the YanaR font, but if you are considering a Helvetica font and just want to install the font in a regular Helvetica, you would do:

 buttonTitleLabel.font = [UIFont fontWithName:@"Helvetica" size:20.0]; 

To make the font bold, all you need to do is add -Bold to the end of the font name, for example:

 buttonTitleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20.0]; 
0
source

You can always create regular and selected state images for your buttons and use them to create the look you are trying to achieve.

0
source

All Articles