nathantannar4 / InputBarAccessoryView

A simple and easily customizable InputAccessoryView for making powerful input bars with autocomplete and attachments
MIT License
1.17k stars 229 forks source link

Hello, how do I implement a custom emoji keyboard? Similar to WeChat. #225

Closed CainLuo closed 2 years ago

CainLuo commented 2 years ago

Hello, how do I implement a custom emoji keyboard? It's similar to WeChat, this problem has been bothering me for a long time, but it seems that because of the inputAccessoryView provided by UIKit, I can only customize it myself, right?

IMG_3662

IMG_3663

Kaspik commented 2 years ago

Put in your own custom UIView that has UICollectionView instead of keyboard, and load whatever content of the collection view you want.

CainLuo commented 2 years ago

Put in your own custom UIView that has UICollectionView instead of keyboard, and load whatever content of the collection view you want.

I'm sorry, I didn't express myself accurately enough, I know how to implement the custom UIView at the bottom, in fact I want to know how to move the InputBarAccessoryView to the corresponding position when the custom UIView at the bottom comes out, because the KeyboardManager in the source code is listening to the relevant notifications, if I want to achieve the effect in the figure, do I need to rewrite the relevant notification methods?

feiyu92 commented 2 years ago

Put in your own custom UIView that has UICollectionView instead of keyboard, and load whatever content of the collection view you want.

I'm sorry, I didn't express myself accurately enough, I know how to implement the custom UIView at the bottom, in fact I want to know how to move the InputBarAccessoryView to the corresponding position when the custom UIView at the bottom comes out, because the KeyboardManager in the source code is listening to the relevant notifications, if I want to achieve the effect in the figure, do I need to rewrite the relevant notification methods?

enum FBKeyboardType { case text case emoji case more } ... var keyboardType: FBKeyboardType = .text ... let button = InputBarButtonItem() .onTouchUpInside { item in self.keyboardType = self.keyboardType == .text ? .more : .text self.inputTextView.inputView = self.keyboardType == .more ? UIView(frame: CGRect(x: 0, y: 0, width: 375, height: 228)) : nil self.inputTextView.reloadInputViews() }

CainLuo commented 2 years ago

Put in your own custom UIView that has UICollectionView instead of keyboard, and load whatever content of the collection view you want.

I'm sorry, I didn't express myself accurately enough, I know how to implement the custom UIView at the bottom, in fact I want to know how to move the InputBarAccessoryView to the corresponding position when the custom UIView at the bottom comes out, because the KeyboardManager in the source code is listening to the relevant notifications, if I want to achieve the effect in the figure, do I need to rewrite the relevant notification methods?

enum FBKeyboardType { case text case emoji case more } ... var keyboardType: FBKeyboardType = .text ... let button = InputBarButtonItem() .onTouchUpInside { item in self.keyboardType = self.keyboardType == .text ? .more : .text self.inputTextView.inputView = self.keyboardType == .more ? UIView(frame: CGRect(x: 0, y: 0, width: 375, height: 228)) : nil self.inputTextView.reloadInputViews() }

Thank you very much. Do you have a corresponding demo that I can run to see?

xiaomage1478 commented 6 months ago

Hello, do you know how inputTextView parses custom emoticons? For example, [dog] can be parsed as 🐶