iOS-仿微信表情键盘的实现YHExpressionKeyBoard(基于Masonry和YYKit)

    最近,由于项目需要,本人基于Masonry和YYKit仿微信表情键盘造了个轮子:YHExpressionKeyBoard。

    先来个简单的效果图:

  


    项目文件结构简要介绍:




 一、初始化方式:


//表情键盘

YHExpressionKeyboard *v = [[YHExpressionKeyboard alloc] initWithViewController:self aboveView:scrV];


 二、键盘代理

 #pragma mark - @protocol YHExpressionKeyboardDelegate

- (void)didSelectExtraItem:(NSString *)itemName{

    UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:itemName message:nilpreferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *ok = [UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {

      

    }];

    [alert addAction:ok];

    [selfpresentViewController:alert animated:YEScompletion:nil];

   

}


三、表情键盘主要是用了UICollectionView实现,如果实现UICollectionView表情横排横滚动,可以参考我的另外一篇文章:iOS- UICollectionView实现表情数据横排横滚动

   输入框最多显示4行,框高的变化动画是Masonry的约束动画实现。



最后,祝大家情人节快乐

YHExpressionKeyBoard 传送门:

https://github.com/samuelandkevin/YHExpressionKeyBoard




猜你喜欢

转载自blog.csdn.net/samuelandkevin/article/details/55101724