Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

italic, bold and underlined font on iPhone

Tags:

How do you set a font to be both bold and italic. There is a boldSystemFontOfSize and italicSystemFoneOfSize, but I can't see the way to set a font to be both italic and bold.

As a second question, is there a way to set an underline on a font, or do you simply draw a line under text.

like image 792
Xetius Avatar asked Sep 05 '09 20:09

Xetius


People also ask

How do you bold or italicize on iPhone?

Easy! Double-tap a word to highlight it and drag the indicators to select multiple words if you want. Then, a menu will pop up. Tap "BIU" here, then select from one of the four options: Bold, Italic, Underline, or Strikethrough.

How do you underline font on iPhone?

To underline a text message on an iPhone you need to first make sure the option is enabled. Once the feature is enabled you long hold over the text you want to underline. Then tap the button showing a “U” which stands for underline. This will underline the highlighted portion of your text message.


1 Answers

You have to actually ask for the bold, italic version of a font. For example:

UIFont *myFont = [UIFont fontWithName:@"Helvetica-BoldOblique" size:[UIFont systemFontSize]]; 

To get a list of everything available on the iPhone, put this little snippet in your applicationDidFinishLaunching: delegate method and look at the log output:

for (NSString *family in [UIFont familyNames]) {     NSLog(@"%@", [UIFont fontNamesForFamilyName:family]); } 

Note: Some font names say "oblique" - this is the same as italic.

I can't see a built-in way of doing underlines - you may have to draw the line yourself.

like image 121
iKenndac Avatar answered Oct 16 '22 13:10

iKenndac