macOS 上 NSPopover 中的表情符号列表,如 Messages App [英] Emoji List in NSPopover on macOS like Messages App
问题描述
我想在我的 Mac 应用程序中显示一个 NSPopover
来列出表情符号,就像 Apple 的消息应用程序那样:
I want to show an NSPopover
in my Mac app that lists the emoji just like Apple's Messages app does like this:
到目前为止我能想到的就是我可以使用这个在我的应用程序中显示字符调色板:
All I can figure out so far is that I can show the character palette in my app using this:
NSApp.orderFrontCharacterPalette(nil)
但这会将调色板显示为一个单独的窗口,如下所示:
But that shows the palette as a separate window like this:
有谁知道我如何在 NSPopover
中嵌入字符调色板并在我的应用中检索选定的表情符号(类似于 Apple 在 Messages 中的做法)?
Does anyone know how I can embed the character palette in an NSPopover
and retrieve the selected emoji in my app (similar to how Apple does it in Messages)?
推荐答案
将您的 textView、textField 或任何其他视图设置为 NSApp.orderFrontCharacterPalette(_:)
的发送者.
Set your textView, textField, or any other view as the sender of NSApp.orderFrontCharacterPalette(_:)
.
NSApp.orderFrontCharacterPalette(self.textField)
这篇关于macOS 上 NSPopover 中的表情符号列表,如 Messages App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!