HMEmoticon 1.0.12

HMEmoticon 1.0.12

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Nov 2016

Maintained by itheima.



HMEmoticon 1.0.12

  • By
  • Fan Liu

仿新浪微博表情键盘

屏幕截图

功能

  • 仿新浪微博表情键盘
  • 支持多用户最近表情记录

系统支持

  • iOS 8.0+
  • Xcode 7.0

安装

使用

Objective-C

  • 导入框架
@import HMEmoticon;
  • 在 Storyboard 中将 UITextViewClass 修改为 HMEmoticonTextView
@property (weak, nonatomic) IBOutlet HMEmoticonTextView *textView;

基本使用

  • 设置用户标示,默认是 Default
// 1. 设置用户标示 - 用于保存最近使用表情
[HMEmoticonManager sharedManager].userIdentifier = @"刀哥";
  • 设置表情键盘属性
// 1> 使用表情视图
_textView.useEmoticonInputView = YES;
// 2> 设置占位文本
_textView.placeholder = @"分享新鲜事...";
// 3> 设置最大文本长度
_textView.maxInputLength = 140;
  • 与原生键盘之间的切换
_textView.useEmoticonInputView = !_textView.isUseEmoticonInputView;

文本转换

  • 符号字符串 转换成 带表情图片的属性字符串
NSString *text = @"[爱你]啊[笑哈哈]";
NSAttributedString *attributeText = [[HMEmoticonManager sharedManager]
    emoticonStringWithString:text
    font:_textView.font
    textColor:_textView.textColor];
  • 获得 符号字符串
_textView.emoticonText