How to right-align the text of menu items

887 views Asked by At

I would like to right-align the text of menu items, I found a sparse solution, but it depends on the number of characters of each menu title (working with spaces):

 NSString *string=[NSString stringWithFormat:@"Text:             %12@",Text];

If there'd be another kind of class to use the menu item text instead of NSString, perhaps I could then use paragraphStyle.

1

There are 1 answers

8
Wain On

Both NSMenuItem and NSStatusItem allow you to setView: to provide a custom set of content. To this view you can add 2 labels, one left aligned and one right aligned (and whatever width you like).