Question

I'm trying to display more than one line of text in a custom UIMenuItem. I've tried using a simple "\n" in the title property of the UIMenuItem but with no luck. Example:

UIMenuItem *menuItem; //Is then allocated properly....

// Before the Menu is displayed
menuItem.title = @"This is a first line.\nThis is a second line.";

Unfortunately I just end up with one line being displayed...

What I want to achieve is something similar to what you can see upon a LongPress on a row in the Apple iPod/Music app.

 Multi-line UIMenuItem in iPod app

I've just found out about this github project as a solution: https://github.com/questbeat/QBPopupMenu

You can display whatever custom UIView within a MenuItem. So I inserted a multi-line UILabel and that works.

However I would rather use the native Apple UIMenutItem approach if this is possible. Any ideas? Thanks in advance.

Était-ce utile?

La solution

You would need to change some internal property of the UIMenuItem, but unfortunately Apple does not provide a way to do it.

So, as for today, there's not way to change the display of a UIMenuItem.

Autres conseils

Have you tried '\r' instead of '\n'?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top