2

In a UITextView is it possible to set the fontname and then set it to bold?

I know that font name and size can be set using fontWithName:(NSString *)fontName size:(CGFloat)fontSize

But once this is done how can i make it bold?

Yogesh Agarwal
  • 2,610
  • 3
  • 27
  • 31

4 Answers4

7

The system font on the iPhone is a good choice for many purposes. You can easily select it in a regular, bold or italic style using built-in font class methods. For example

  UIFont *mainTitleFont = [UIFont boldSystemFontOfSize:14.0];
  UIFont *subTitleFont = [UIFont SystemFontOfSize:14.0];
  UIFont *textFont = [UIFont italicSystemFontOfSize:12.0];

But what if you want a font using both bold and italic at the same time, or a different typeface altogether? In that case, you can use the “fontWithName” method as follows.

  UIFont *altFont = [UIFont fontWithName:@"Courier-Bold" size:14.0];

Reference

Gyani
  • 2,241
  • 1
  • 24
  • 38
1

Use the Bold variant of the font, e.g. @"Helvetica-Bold" as the fontName. If using the default system font is ok for you, you can also use boldSystemFontOfSize: method instead.

Tomas Vana
  • 18,317
  • 9
  • 53
  • 64
1
UIFont *f = [UIFont fontWithName:@"Verdana-Bold" size:12];
yourTextView.font = f;
PJR
  • 13,052
  • 13
  • 64
  • 104
0

If you want to give font with name then you can refer below link. It have all font which are provided by iOS with their font names.

iOS Fonts

Thanks.

MinuMaster
  • 1,457
  • 1
  • 13
  • 29