Jeremiah Smith
Jeremiah Smith

Reputation: 740

How to right-align the text of menu items

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.

Upvotes: 0

Views: 896

Answers (1)

Wain
Wain

Reputation: 119031

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).

Upvotes: 2

Related Questions