I would like to generate a button or label with the same visual plus sign or icons as used in the UIButtonBar system items. Is there a way to determine what font and characters are being used to generate these items?
Breaking this into two answers:
The system fonts: Helvetica Neue Ultralight is used by iOS 7, while iOS 6 uses Helvetica (or more specifically, the nearly-identical Helvetica Neue).
If you are trying to make icons that look like iOS defaults, I have used http://www.glyphish.com/ successfully.
Related
I want a monospace font for my UILabel in my iOS application.
Unfortunately, I could not find one. Even "American Typewriter" was not actually monospaced. What is a monospace font available in XCode?
iOS mono-spaced fonts
Courier
Courier-Bold
Courier-BoldOblique
Courier-Oblique
CourierNewPS-BoldItalicMT
CourierNewPS-BoldMT
CourierNewPS-ItalicMT
CourierNewPSMT
Menlo-Bold
Menlo-BoldItalic
Menlo-Italic
Menlo-Regular
iosfonts.com maintain a list of all iOS fonts.
This webpage detects your installed system fonts and returns a fairly comprehensive list.
Looking at an old listing of fonts shipped with iOS I see several one monospace fonts.
(eg. Andale Mono, Monaco, Courier New)
For 2018 it's only Menlo and Courier.
If your intent is to display numbers and you don't care about the specific font used, you can do this:
UIFont.monospacedDigitSystemFontOfSize(
UIFont.systemFontSize(),
weight: UIFontWeightRegular)
Adobe just released a nice monospaced font Source Code Pro in both TTF and OTF formats.
It's licensed with the Open Font License so it is available for free use within applications, including commercial applications.
You will need to add the font file as a resource in Xcode, by setting the UIAppFonts key in the info.plist to point to the SourceCodeProRegular.ttf file.
Now in your code you can set, for example:
self.textView.font = [UIFont fontWithName:#"Source Code Pro" size:14];
Expanding upon #reggie-pinkham's answer, I built this JS Bin for folks to use as a live test page; to save future reader's some time, here's a few screen shots using iOS Simulator on Mavericks:
iPad Air, iOS 8.1
iPhone 6 plus, iOS 8.1
As of iOS 13, San Francisco (SF) Mono is available. Couldn't find a way to set this in interface builder, but by code it's:
let font = UIFont.monospacedSystemFont(ofSize: 17.0, weight: .regular)
If you're looking for a monospace font for numbers, then try "Helvetica Neue".
A list of built-in fonts available on iOS: http://iosfonts.com. Courier and Menlo seem to be the only monospace fonts in there.
SwiftUI
You can use Font's instance method monospacedDigit
Text("0123456789")
.foregroundColor(.white)
.font(Font.custom("San Francisco", size: 20).monospacedDigit())
You can access system fonts in monospaced with the following Font factory method:
static func system(Font.TextStyle, design: Font.Design) -> Font
Example:
let monospacedBody = Font.system(.body, .monospaced)
Other usage:
let serifTitle = Font.system(.title, .serif)
In the meantime there is a good Monospace font available from Apple, that can be downloaded here: Apple SFUI
Here is how to add the fonts to Xcode: Add fonts to xcode
In my app I need to support iOS since iOS 7. As you know iOS 9 uses new system font "San-Francisco".
Is it possible some how to use system font (to make native font for operation system) with setting size and attributes like Light, Medium, Bold, Italic, etc?
I found only one solution to hard code font name as for iOS 9 use "San-Francisco" and for less use "HelveticaNueue".
Maybe some one know a better solution.
Helvetica Neue is the default font in iOS 7/8. When building hybrid apps, how do you include Helvetica Neue as the font?
It does not seem to be a free font. Or are most hybrid app developers pulling an open source version of Helvetica Neue from a CDN?
Helvetica Neue is not a free font sadly, and isn't licensed by standard on Android. It gets pretty expensive if you want to embed it within your app outside of iOS (see Linotype)
I guess you have a few options:
"Roboto" was first included in Ice Cream Sandwich, and looks very similar - comparison here. So you could include this in your CSS stack.
Use a similar open source font like Open Sans (Google Fonts) and embed the TTF file into your app.
Use a CSS stack that starts with Helvetica Neue, and works its way backwards to less nice fonts, depending on what platform the hybrid app is running on - i.e. this stack. You could add Roboto earlier in the stack if you like it...
The font called from [UIFont boldSystemFontWithSize xx] is not fixed-width, I don't know the exact name of this system font (iOS 6).
I'm wondering if there is a built-in fixed-width font? Otherwise I have to embed a new font to my app.
PS: maybe iOS 7 system font is fixed-width, LOL
Thanks guys.
Here's the list of built-in fonts available on iOS: http://iosfonts.com.
Courier looks like the only monospace font in there.
I want a monospace font for my UILabel in my iOS application.
Unfortunately, I could not find one. Even "American Typewriter" was not actually monospaced. What is a monospace font available in XCode?
iOS mono-spaced fonts
Courier
Courier-Bold
Courier-BoldOblique
Courier-Oblique
CourierNewPS-BoldItalicMT
CourierNewPS-BoldMT
CourierNewPS-ItalicMT
CourierNewPSMT
Menlo-Bold
Menlo-BoldItalic
Menlo-Italic
Menlo-Regular
iosfonts.com maintain a list of all iOS fonts.
This webpage detects your installed system fonts and returns a fairly comprehensive list.
Looking at an old listing of fonts shipped with iOS I see several one monospace fonts.
(eg. Andale Mono, Monaco, Courier New)
For 2018 it's only Menlo and Courier.
If your intent is to display numbers and you don't care about the specific font used, you can do this:
UIFont.monospacedDigitSystemFontOfSize(
UIFont.systemFontSize(),
weight: UIFontWeightRegular)
Adobe just released a nice monospaced font Source Code Pro in both TTF and OTF formats.
It's licensed with the Open Font License so it is available for free use within applications, including commercial applications.
You will need to add the font file as a resource in Xcode, by setting the UIAppFonts key in the info.plist to point to the SourceCodeProRegular.ttf file.
Now in your code you can set, for example:
self.textView.font = [UIFont fontWithName:#"Source Code Pro" size:14];
Expanding upon #reggie-pinkham's answer, I built this JS Bin for folks to use as a live test page; to save future reader's some time, here's a few screen shots using iOS Simulator on Mavericks:
iPad Air, iOS 8.1
iPhone 6 plus, iOS 8.1
As of iOS 13, San Francisco (SF) Mono is available. Couldn't find a way to set this in interface builder, but by code it's:
let font = UIFont.monospacedSystemFont(ofSize: 17.0, weight: .regular)
If you're looking for a monospace font for numbers, then try "Helvetica Neue".
A list of built-in fonts available on iOS: http://iosfonts.com. Courier and Menlo seem to be the only monospace fonts in there.
SwiftUI
You can use Font's instance method monospacedDigit
Text("0123456789")
.foregroundColor(.white)
.font(Font.custom("San Francisco", size: 20).monospacedDigit())
You can access system fonts in monospaced with the following Font factory method:
static func system(Font.TextStyle, design: Font.Design) -> Font
Example:
let monospacedBody = Font.system(.body, .monospaced)
Other usage:
let serifTitle = Font.system(.title, .serif)
In the meantime there is a good Monospace font available from Apple, that can be downloaded here: Apple SFUI
Here is how to add the fonts to Xcode: Add fonts to xcode