Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find System Bold Font for Attribute String iOS Xcode

I my App. at many places I have used System Bold Font, which has became standard in my App.

If I use Attributed String by default font which appears is "Helvetica Neue". In all Fonts, I searched for System Bold Font, but could not find it.

So, how can I set System bold font when using Attributed String?

enter image description here

like image 748
NNikN Avatar asked Jan 07 '14 03:01

NNikN


Video Answer


1 Answers

You can make it work by code. I had to face exactly same problem while assigning a attributed string to UILabel. i solved it by code. See the code bellow:

    NSString *s = @"Why so serious?";
    NSMutableAttributedString *str=[[NSMutableAttributedString alloc] initWithString:s];
    NSInteger _stringLength=[s length];
    UIColor *_red=[UIColor redColor];
    [str addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:25] range:NSMakeRange(0, _stringLength)];
    [str addAttribute:NSStrokeColorAttributeName value:_red range:NSMakeRange(0, _stringLength)];
    [str addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithFloat:-3.0] range:NSMakeRange(0, _stringLength)];
    self.aLabel.attributedText = str;

Hope this helps. :)

like image 51
Rashad Avatar answered Nov 09 '22 04:11

Rashad