What is a monospace font in iOS?

前端 未结 10 1279
半阙折子戏
半阙折子戏 2020-12-02 19:41

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

相关标签:
10条回答
  • 2020-12-02 20:36

    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

    ipad-air-ios-8.1

    iPhone 6 plus, iOS 8.1

    iphone-6-plus-ios-8.1

    0 讨论(0)
  • 2020-12-02 20:38

    If you're looking for a monospace font for numbers, then try "Helvetica Neue".

    0 讨论(0)
  • 2020-12-02 20:39

    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)
    
    0 讨论(0)
  • 2020-12-02 20:41

    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.

    0 讨论(0)
提交回复
热议问题