我正尝试在自定义UIMenuItem中显示多行文本。我尝试在UIMenuItem的title属性中使用简单的"\n“,但没有成功。示例:
UIMenuItem *menuItem; //Is then allocated properly....
// Before the Menu is displayed
menuItem.title = @"This is a first line.\nThis is a second line.";不幸的是,我最后只显示了一行……
我想要实现的东西类似于你可以在苹果iPod/音乐应用程序的LongPress上看到的东西。

我刚刚发现了这个github项目的解决方案:https://github.com/questbeat/QBPopupMenu
您可以在MenuItem中显示任何自定义UIView。所以我插入了一个多行的UILabel,这是可行的。
然而,如果可能的话,我更愿意使用原生的苹果UIMenutItem方法。有什么想法吗?提前谢谢。
发布于 2013-04-08 03:40:32
你需要更改UIMenuItem的一些内部属性,但不幸的是苹果没有提供这样做的方法。
因此,就目前而言,还没有办法改变UIMenuItem的显示。
发布于 2013-04-08 08:59:41
您是否尝试过'\r‘而不是'\n'?
https://stackoverflow.com/questions/15866681
复制相似问题