仿微信表情鍵盤:左->語音按鈕,中間->輸入條+按住錄音,右->表情按鈕+拓展按鈕;每個按鈕都可以隱藏或顯示;
朋友圈表情鍵盤:平時不顯示底部輸入欄,點擊cell時候再顯示輸入欄;
先在終端裡搜索pod search QKeyboardEmotionView
如果搜索不到2.2版本,需要更新你電腦的pod倉庫,以下是更新步驟:
1、先pod repo update更新你本地電腦的pod倉庫。然後再搜索一次試試看
2、如果還是搜索不到,執行rm ~/Library/Caches/CocoaPods/search_index.json 。再搜索就OK了
OC 調用方式:
- ( void )viewDidLoad {
[ super viewDidLoad ];
// 初始化输入工具条,frame可以先这样临时设置,下面的addBottomInputBarView方法会重置输入条frame
// 如果你想要自定义输入条View,请参考TextFieldViewController代码
_inputView = [[QInputBarView alloc ] initWithFrame: CGRectMake ( 0 , 0 , self .view.frame.size.width,UIInputBarViewMinHeight)];
_inputView. dataSource = self;
_inputView. delegate = self;
// keyboard管理类,用来管理键盘,各大面板的切换
_keyboardManager = [[QKeyboardManager alloc ] initWithViewController: self ];
_keyboardManager. dataSource = self;
//因为addBottomInputBarView方法会立刻触发delegate,所以这里需要先设置delegate
_keyboardManager. delegate = self;
//将输入条View添加到ViewController;YES表示输入条平时不显示(比如朋友圈);NO表示平时也显示(比如聊天)
[_keyboardManager addBottomInputBarView: _inputView belowViewController: NO ];
//把输入框(如果有的话)绑定给管理类
[_keyboardManager bindTextView: _inputView.inputTextView];
}Swift 調用方式:
override func viewDidLoad ( ) {
super . viewDidLoad ( )
// 初始化输入工具条,frame可以先这样临时设置,下面的addBottomInputBarView方法会重置输入条frame
// 如果你想要自定义输入条View,请参考TextFieldViewController代码
bottomInputView = QInputBarView ( frame : CGRect . init ( x : 0 , y : 0 , width : view . frame . size . width , height : CGFloat ( UIInputBarViewMinHeight ) ) )
bottomInputView . delegate = self ;
//keyboard管理类,用来管理键盘,各大面板的切换
keyboardManager = QKeyboardManager ( viewController : self ) ;
keyboardManager . dataSource = self ;
//因为addBottomInputBarView方法会立刻触发delegate,所以这里需要先设置delegate,再addBottomInputBarView
keyboardManager . delegate = self ;
//将输入条View添加到ViewController;YES表示输入条平时不显示(比如朋友圈);NO表示平时也显示(比如聊天)
keyboardManager . addBottomInputBarView ( bottomInputView , belowViewController : belowViewController ( ) )
//把输入框(如果有的话)绑定给管理类
keyboardManager . bindTextView ( bottomInputView . inputTextView )
}參數配置
@property (nonatomic, strong) UIColor *inputBarBackgroundColor; //输入条颜色,默认仿微信的灰色
@property (nonatomic, strong) UIColor *inputBarBoardColor; //输入条上方的的那一条细横线的颜色
@property (nonatomic, strong) UIColor *textColor; //输入栏textview的颜色
@property (nonatomic, strong) UIColor *textViewBackgroundColor; //输入栏textview的背景颜色,默认白色
@property (nonatomic, strong) UIColor *recordButtonTitleColor; //按住说话按钮的字体颜色
@property (nonatomic, assign) BOOL voiceButtonHidden; //是否隐藏发送语音 default is NO
@property (nonatomic, assign) BOOL extendButtonHidden; //是否隐藏发送多媒体 default is NO
@property (nonatomic, assign) BOOL emotionButtonHidden; //是否隐藏发送表情 default is NO
// 点击键盘右下角的按钮是否是发送,NO表示普通回车换行,YES表示回调Delegate的Send方法
@property (nonatomic, assign) BOOL keyboardSendEnabled; // default is YES
// 输入栏TextView的高度发送变化的动画时长(秒)
@property (nonatomic, assign) NSTimeInterval inputBarHeightChangeAnimationDuration; // default is 0.2 pod 'QKeyboardEmotionView' 285275534, [email protected]
我的其他開源庫,給個Star鼓勵我寫更多好庫:
IOS Swift項目框架模版Demo,教科書級標準。輕量、規範、易懂、易移植、解耦
IOS 1:1完美仿微信聊天表情鍵盤
IOS 自定義UIAlertController,支持彈出約束XibView、彈出ViewController
IOS 封裝每條Cell樣式都不一致的UITableView,告別複雜的UITableViewDataSource
IOS 仿快手直播界面加載中,頂部的滾動條狀LoadingView
IOS 基於個推+華為push的一整套完善的IM聊天系統
Android 朋友圈列表Feed流的最優化方案,讓你的RecyclerView從49幀-> 57幀
Android 仿大眾點評、仿小紅書下拉拖拽關閉Activity
Android 仿快手直播間手畫禮物,手繪禮物
Android 直播間聊天消息列表RecyclerView。一秒內收到幾百條消息依然不卡頓
Android 仿快手直播界面加載中,頂部的滾動條狀LoadingView
Android Kotlin MVVM框架,全世界最優化的分頁加載接口、最接地氣的封裝
Android 基於個推+華為push的一整套完善的android IM聊天系統
QKeyboardEmotionView is available under the MIT license. See the LICENSE file for more info.