仿微信表情键盘:左->语音按钮,中间->输入条+按住录音,右->表情按钮+拓展按钮;每个按钮都可以隐藏或显示;
朋友圈表情键盘:平时不显示底部输入栏,点击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.2pod '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.