What is a monospace font in iOS?

前端 未结 10 1277
半阙折子戏
半阙折子戏 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: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)
    

提交回复
热议问题