TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2016 |
Maintained by itheima.
仿新浪微博表情键盘
@import HMEmoticon;
UITextView
的 Class
修改为 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