1.创建表情的View
//改变内容
// Created by 张君宝 on 15/11/18.// Copyright © 2015年 海睿星巢文化. All rights reserved.//#import#import "ADTInsertEmojiCellNode.h"
@interface InputContentInChatViewManager : NSObject
{
@private
NSMutableArray *arrEmoji;
NSMutableString *strInputContent;
int m_length;
}
@property (nonatomic,strong)NSDictionary *Global_TopicEmoji;
+(InputContentInChatViewManager *)sharedInstance;
//设置当前文本字符串
-(void)setCurrentWordContent:(NSString *)inputString;
//清空输入内容
-(void)clearInputConten;
-(void)insertEmojiNode:(ADTInsertEmojiCellNode *)insertNode;
//根据当次的删除range寻找数组是否有符合此range的数组,有则删除
-(void)deleteEmojisWith:(NSRange)deleteRange;
-(int)lengthOfEmoji;
-(int)lengthOfWordChar;
@end
。m文件
#import@interface ADTInsertEmojiCellNode : NSObject
@property (nonatomic,assign)NSInteger m_insertIndex;//当前操作在整个字符串的位置,默认从0开始
@property (nonatomic,assign)NSInteger m_selectedEmojiIndex;//当前操作的表情字符串数组中得位置,默认从零开始
@property (nonatomic,assign)BOOL m_isDeleted;//被搜索到的删除就置为yes
@property (nonatomic,copy)NSString *m_oriEmo;
@property (nonatomic,copy)NSString *m_tranEmo;
@end
#import "ADTInsertEmojiCellNode.h"
@implementation ADTInsertEmojiCellNode
-(id)init
{
if (self=[super init]) {
self.m_selectedEmojiIndex=0;
self.m_insertIndex=0;
self.m_isDeleted=0;
}
return self;
}
@end
plist 文件
这里就创建完了,发表于显示在label 上可以参考
https://github.com/zekunyan/UITextViewDIYEmojiExample