Clifton Labrum
Clifton Labrum

Reputation: 14118

Emoji List in NSPopover on macOS like Messages App

I want to show an NSPopover in my Mac app that lists the emoji just like Apple's Messages app does like this:

Messages Emoji Popover

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: macOS Character Palette

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)?

Upvotes: 3

Views: 802

Answers (1)

1024jp
1024jp

Reputation: 2208

Set your textView, textField, or any other view as the sender of NSApp.orderFrontCharacterPalette(_:).

NSApp.orderFrontCharacterPalette(self.textField)

Upvotes: 5

Related Questions