当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - How to display more than one line in UIMenuItem?

问题描述:

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.

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.

网友答案:

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.

网友答案:

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: