怎么做呢?我正在寻找一个密集的、纯图形的点击保持菜单。
3 回答
In 3.2 you can add menu items using the menuItems
property. But I think subclassing won't be useful, since it's a singleton that does not returns the views of each menu item. You could access menuFrame
when setMenuVisible:animated:
is called, so you can add you're own view that looks like a menu items with icons. But for adding icons to the system menu items... I think you should stick to what's Apple is giving you ;)
我的低声誉不允许我发布链接,因此我在这里再次回答:
检查表情符号和符号,也许它适合您的目的。
转到您的 Xcode 菜单 -> 编辑 -> 表情符号和符号。
前任。:
let menuItemYes = UIMenuItem(title: "✅", action: "doSomething")
祝你好运!
I wrote a category to support image for UIMenuItem. It's based on method swizzling, but should be safe in most cases.
https://github.com/cxa/CXAImageMenuItem
Note: duplicate answer to https://stackoverflow.com/a/14140904/395213
EDIT: the above link is 404'ed, this link works