像Messages App一样在macOS上的NSPopover中的表情符号列表 [英] Emoji List in NSPopover on macOS like Messages App

查看:125
本文介绍了像Messages App一样在macOS上的NSPopover中的表情符号列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Mac应用程序中显示一个NSPopover,其中列出了表情符号,就像Apple的Messages应用程序一样:

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)

这篇关于像Messages App一样在macOS上的NSPopover中的表情符号列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆