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?
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"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With