ChrisP
ChrisP

Reputation: 10116

How do I remove bold from a UILabel text in Objective-C?

I have a UILabel control (title) in a UITableViewCell (cell) where I set the font to bold using the following

cell.title.font=[UIFont boldSystemFontOfSize:self.textFontSize];

How do I change the font back to normal/regular weight?

Upvotes: 0

Views: 2008

Answers (3)

Arkku
Arkku

Reputation: 42119

As others have said, you indeed just reassign font to a non-bold version of the font. As an additional note, if you don't have self.textFontSize available anymore (or it may have changed), you could do:

cell.title.font=[UIFont systemFontOfSize:cell.title.font.pointSize];

If the system font was just an example (and it could be an arbitrary bold font), then you could try to get the familyName of the existing font and use that in hopes of constructing a new non-bold version.

Upvotes: 2

Owen Hartnett
Owen Hartnett

Reputation: 5935

Am I missing something?

cell.title.font=[UIFont systemFontOfSize:self.textFontSize];

Upvotes: 2

logancautrell
logancautrell

Reputation: 8772

You can use the systemFontOfSize method on UIFont.

cell.title.font=[UIFont systemFontOfSize:self.textFontSize];

Upvotes: 2

Related Questions