I want to change from proportional to tabulated digits in menu items? It's possible?
Asked
Active
Viewed 79 times
-2
-
1Your question asked for how to add tabs to format your menu items. Although the accepted answer shows how to get around needing tabs it doesn’t answer your question as it was asked. If the answer satisfies your need please consider editing the question so that the answer and the question match. – Jun 08 '17 at 14:24
-
I read it as asking about monospaced digits, fwiw. – Wevah Jun 11 '17 at 14:40
2 Answers
1
You need to use the monospaced font like this:
label.font = UIFont.monospacedDigitSystemFont(ofSize: 17, weight: UIFontWeightRegular)
Obviously you can specify whatever font size and weight you want (or get them from the current font descriptor).

Upholder Of Truth
- 4,643
- 2
- 13
- 23
0
You can set the attributedTitle
property of a NSMenuItem
and provide whatever custom alignment or formatting you want through an NSAttributedString
Good examples of how to do string alignment in an attributed string can be seen here:
Attributed Text Center Alignment
Here is an answer that shows how to add tab stops to an attributed string:
How do I add tab stops to an NSAttributedString
You can even create an attributed string from RTF or HTML: