I would like to create an NSMenuItem
with more than one line of text in it, and I'd also like an icon to appear next to both lines of text. I can't use a custom view, because then it wouldn't highlight correctly, and I can't just put a newline in the menu item's title, because the newline gets turned into a space. What should I do?
Asked
Active
Viewed 812 times
5

tbodt
- 16,609
- 6
- 58
- 83
1 Answers
8
It turns out that although you can't put a newline in the title
property of a menu item, you can put a newline in the attributedTitle
. Something like this will work:
item.attributedTitle = [[NSAttributedString alloc] initWithString:@"line 1\nline 2"];

tbodt
- 16,609
- 6
- 58
- 83