1.自定义一个表情包类继承NSTextAttachment
1 #import <UIKit/UIKit.h> 2 3 /** 表情包的自定义类*/ 4 @interface EmojiTextAttach : NSTextAttachment 5 6 @property (nonatomic,assign) NSRange range; 7 8 /** 绑定NSTextAttachment所表示的表情和与其对应的标志*/ 9 @property (nonatomic, copy) NSString *emojiTag; 10 11 /** 表情名称*/ 12 @property (nonatomic, copy) NSString *emojiName; 13 14 15 @end