类引用说明
BQMM/MMEmotionCentre.h
说明: iOS SDK核心头文件
- MMEmotionCentreDelegate协议方法 - 表情点击回调
- (void)didSelectEmoji:(MMEmoji *)emoji;
- didClickGifTab - 点击表情键盘底栏gif按钮的回调
- (void)didClickGifTab;
- didSelectTipEmoji - 点击联想表情的回调
- (void)didSelectTipEmoji:(MMEmoji *)emoji;
- didSendWithInput - 点击表情键盘上发送按钮的代理
- (void)didSendWithInput:(UIResponder<UITextInput> *)input;
- tapOverlay - 当表情键盘打开时,点击输入框的代理
- (void)tapOverlay;
- 指定表情点击回调代理
@property (nonatomic, weak) id<MMEmotionCentreDelegate> delegate;
- SDK模式 默认为
MMSDKModeIM
@property (nonatomic) MMSDKMode sdkMode;
- SDK语言 默认为
MMLanguageChinese
@property (nonatomic) MMLanguage sdkLanguage;
- SDK区域 默认为
MMRegionChina
@property (nonatomic) MMRegion sdkRegion;
- supportedMixedTextImage - 是否支持图文混排消息,默认为
YES
@property (nonatomic) BOOL supportedMixedTextImage;
- defaultCentre - 表情管理中心默认实例(单例)
+ (instancetype)defaultCentre;
- 当前SDK的版本
- (NSString *)version;
- userId - (可选)如传递当前登录userId,后期可获取特定用户表情使用习惯等
- (void)setUserId:(NSString *)userId;
- 使用第三方key和id来初始化SDK
- (void)setAppkey:(nonnull NSString *)appkey platformId:(nonnull NSString *)platformId;
- setAppId 注册appId&appSecret
- (void)setAppId:(NSString *)appId secret:(NSString *)secret;
- setTheme - 设置表情商店主题,主题对象参考
MMTheme.h
- (void)setTheme:(MMTheme *)theme;
- setDefaultEmojiArray - 设置自定义默认表情包
- (void)setDefaultEmojiArray:(nonnull NSArray<NSString *> *)emojiArray;
- attachEmotionKeyboardToInput - 切换到到键盘视图
- (void)attachEmotionKeyboardToInput:(UIResponder<UITextInput> *)input;
- switchToDefaultKeyboard - 切换到到默认键盘视图
- (void)switchToDefaultKeyboard;
- shouldShowShotcutPopoverAboveView - 根据文字弹出候选表情
- (void)shouldShowShotcutPopoverAboveView:(UIView *)attchedView withInput:(UIResponder<UITextInput> *)input;
// attachedView: 表情提示bubble出现在这个view上
// input: 侦测这个input试图的输入变化
- setUnicodeEmojiTabEnabled - 是否显示unicode emoji表情tab,默认YES显示
- (void)setUnicodeEmojiTabEnabled: (BOOL)enable;
- presentShopViewController - 调出商店页面
- (void)presentShopViewController;
- fetchEmojisByType - 根据
emojiCodes
和fetchType
批量获取表情
- (void)fetchEmojisByType:(MMFetchType)fetchType codes:(NSArray *)emojiCodes completionHandler:(void (^)(NSArray *emojis))completionHandler;
- trendingGifsAt - 获取流行GIF表情数据 ```objectivec
(void)trendingGifsAt:(int)page
withPageSize:(int)pageSize
completionHandler:(void (^ nonnull)(NSArray * nullable gifs, NSError * __nullable error))completionHandler; ```
searchGifsWithKey - 根据
key
获取GIF表情数据 ```objectivec- (void)searchGifsWithKey:(NSString * _Nullable)key
```At:(int)page withPageSize:(int)pageSize completionHandler:(void (^ __nonnull)(NSString * __nonnull searchKey, NSArray<MMGif *> * __nullable gifs, NSError * __nullable error))completionHandler;
- MMFetchType - 表情类型
typedef enum
{
MMFetchTypeSmall = 1 << 0, //小表情
MMFetchTypeBig = 1 << 1, //大表情
MMFetchTypeAll = 1 << 2 //全部表情
} MMFetchType;
- MMSDKMode - SDK模式
typedef enum
{
MMSDKModeIM = 1 << 0, //IM模式
MMSDKModeComment = 1 << 1, //评论模式
} MMSDKMode;
- SDK 区域
typedef enum
{
MMRegionChina = 0,
MMRegionOther = 1,
} MMRegion;
- SDK 语言
typedef enum
{
MMLanguageChinese,
MMLanguageEnglish,
} MMLanguage;
- clearSession - 清空session,在App重新在前台打开时调用
- (void)clearSession;
- clearCache - 清除缓存
- (void)clearCache;
BQMM/MMTheme.h
说明: iOS SDK外观定制头文件
groupViewBgColor - 键盘背景色
@property (nonatomic, strong) UIColor *groupViewBgColor;
inputToolViewBgColor - 键盘表情包背景色
@property (nonatomic, strong) UIColor *inputToolViewBgColor;
packageBgColor - 键盘表情包背景色
@property (nonatomic, strong) UIColor *packageBgColor;
packageSelectedBgColor - 键盘表情包选中状态背景色
@property (nonatomic, strong) UIColor *packageSelectedBgColor;
sendBtnBgColor - 键盘底部发送按钮的背景色
@property (nonatomic, strong) UIColor *sendBtnBgColor;
sendBtnTitleColor - 键盘底部发送按钮的文字的颜色
@property (nonatomic, strong) UIColor *sendBtnTitleColor;
navigationBarColor - 表情商店顶部导航条颜色
@property (nonatomic, strong) UIColor *navigationBarColor;
navigationBarTintColor - 表情商店顶部导航条文字颜色
@property (nonatomic, strong) UIColor *navigationBarTintColor;
navigationTitleFont - 表情商店顶部导航条文字字体
@property (nonatomic, strong) UIFont *navigationTitleFont;
separateColor - 分隔线的颜色
@property (nonatomic, strong) UIColor *separateColor;
shopCategoryFont - 在商店界面,表情分类名文字字体
@property (nonatomic, strong) UIFont *shopCategoryFont;
shopCategoryColor - 在商店界面,表情分类名文字颜色
@property (nonatomic, strong) UIColor *shopCategoryColor;
shopPackageTitleFont - 在商店界面,表情包标题文字字体
@property (nonatomic, strong) UIFont *shopPackageTitleFont;
shopPackageTitleColor - 在商店界面,表情包标题文字颜色
@property (nonatomic, strong) UIColor *shopPackageTitleColor;
shopPackageSubTitleFont - 在商店界面,表情包子标题文字字体
@property (nonatomic, strong) UIFont *shopPackageSubTitleFont;
shopPackageSubTitleColor - 在商店界面,表情包子标题文字颜色
@property (nonatomic, strong) UIColor *shopPackageSubTitleColor;
removeBtnBgColor - 在已下载表情界面,移除按钮背景色
@property (nonatomic, strong) UIColor *removeBtnBgColor;
removeBtnTitleFont - 在已下载表情界面,移除按钮字体
@property (nonatomic, strong) UIFont *removeBtnTitleFont;
removeBtnTitleColor - 在已下载表情界面,移除按钮字颜色
@property (nonatomic, strong) UIColor *removeBtnTitleColor;
removeBtnBorderColor - 在已下载表情界面,移除按钮边框颜色
@property (nonatomic, strong) UIColor *removeBtnBorderColor;
detailPackageTitleFont - 表情包详情页标题文字字体
@property (nonatomic, strong) UIFont *detailPackageTitleFont;
禁止下载label的背景色
@property (nonatomic, strong, nullable) UIColor *detailPackageBannedBgColor;
禁止下载label的字体
@property (nonatomic, strong, nullable) UIFont *detailPackageBannedFont;
禁止下载label的字体颜色
@property (nonatomic, strong, nullable) UIColor *detailPackageBannedColor;
detailPackageTitleColor - 表情包详情页标题文字颜色
@property (nonatomic, strong) UIColor *detailPackageTitleColor;
detailPackageDescFont - 表情包详情页描述文字字体
@property (nonatomic, strong) UIFont *detailPackageDescFont;
detailPackageDescColor - 表情包详情页描述文字颜色
@property (nonatomic, strong) UIColor *detailPackageDescColor;
detailPackagePreviewFont - 表情包详情页"长按表情可预览"文字字体
@property (nonatomic, strong) UIFont *detailPackagePreviewFont;
detailPackagePreviewColor - 表情包详情页"长按表情可预览"文字颜色
@property (nonatomic, strong) UIColor *detailPackagePreviewColor;
downloadTitleFont - 表情包列表"下载"按钮文字字体
@property (nonatomic, strong) UIFont *downloadTitleFont;
downloadTitleColor - 表情包列表"下载"按钮文字颜色
@property (nonatomic, strong) UIColor *downloadTitleColor;
downloadedTitleColor - 表情包列表"已下载"按钮文字颜色
@property (nonatomic, strong) UIColor *downloadedTitleColor;
downloadedBgColor - 表情包列表"已下载"按钮背景色
@property (nonatomic, strong) UIColor *downloadedBgColor;
downloadedBorderColor - 表情包列表"已下载"按钮边框颜色背景色
@property (nonatomic, strong) UIColor *downloadedBorderColor;
downloadBorderColor - 表情包列表下载控件边框颜色
@property (nonatomic, strong) UIColor *downloadBorderColor;
downloadBgColor - 表情包列表下载控件背景色
@property (nonatomic, strong) UIColor *downloadBgColor;
downloadingColor - 表情包列表下载控件下载进度条下载中填充色
@property (nonatomic, strong) UIColor *downloadingColor;
downloadingTextColor - 表情包列表下载控件下载中文字颜色
@property (nonatomic, strong) UIColor *downloadingTextColor;
copyrightFont - 表情包详情页,底部版权文字字体
@property (nonatomic, strong) UIFont *copyrightFont;
copyrightColor - 表情包详情页,底部版权文字颜色
@property (nonatomic, strong) UIColor *copyrightColor;
promptLabelFont - 错误提示文字字体
@property (nonatomic, strong) UIFont *promptLabelFont;
promptLabelColor - 错误提示文字颜色
@property (nonatomic, strong) UIColor *promptLabelColor;
retryBtnFont - 键盘内错误提示重试按钮字体
@property (nonatomic, strong) UIFont *retryBtnFont;
retryBtnColor - 键盘内错误提示重试按钮文字颜色
@property (nonatomic, strong) UIColor *retryBtnColor;
retryBtnBgColor - 键盘内错误提示重试按钮背景色
@property (nonatomic, strong) UIColor *retryBtnBgColor;
retryBtnBorderColor - 键盘内错误提示重试按钮边框颜色
@property (nonatomic, strong) UIColor *retryBtnBorderColor;
shopBtnBgColor - 键盘商店按钮背景色
@property (nonatomic, strong) UIColor *shopBtnBgColor;
shopBtnIconColor - 键盘商店按钮图标颜色
@property (nonatomic, strong) UIColor *shopBtnIconColor;
remindLabelFont - 表情预览页面错误提示文字字体
@property (nonatomic, strong) UIFont *remindLabelFont;
remindLabelColor - 表情预览页面错误提示文字颜色
@property (nonatomic, strong) UIColor *remindLabelColor;
loadFailedLabelFont - 商店内错误页面提示文字字体
@property (nonatomic, strong) UIFont *loadFailedLabelFont;
loadFailedLabelColor - 商店内错误页面提示文字颜色
@property (nonatomic, strong) UIColor *loadFailedLabelColor;
reloadBtnFont - 商店内错误页面重试按钮字体
@property (nonatomic, strong) UIFont *reloadBtnFont;
reloadBtnColor - 商店内错误页面重试按钮文字颜色
@property (nonatomic, strong) UIColor *reloadBtnColor;
orderBtnColor - 我的表情页面排序按钮的颜色
@property (nonatomic, strong, nullable) UIColor *orderBtnColor;
finishBtnColor - 我的表情页面完成状态按钮的颜色
@property (nonatomic, strong, nullable) UIColor *finishBtnColor;
packageBannedBgColor - 表情包禁止下载的提示背景颜色
@property (nonatomic, strong, nullable) UIColor *packageBannedBgColor;
packageBannedTextColor - 表情包禁止下载的提示文字颜色
@property (nonatomic, strong, nullable) UIColor *packageBannedTextColor;
packageBannedTextFont - 表情包禁止下载的提示文字字体
@property (nonatomic, strong, nullable) UIFont *packageBannedTextFont;
keyboardHeight - 键盘高度
@property (nonatomic, assign) CGFloat keyboardHeight;
emojiTitleBgColor - 表情view底部title view的背景色
@property (nonatomic, strong, nullable) UIColor *emojiTitleBgColor;
emojiTitleBgColor - 表情view底部title view的第一个label的背景色
@property (nonatomic, strong, nullable) UIColor *emojiTitle1Color;
emojiTitleBgColor - 表情view底部title view的第二个label的背景色
@property (nonatomic, strong, nullable) UIColor *emojiTitle2Color;
BQMM/MMEmoji.h
- emojiId - 表情Id
@property (nonatomic, copy) NSString *emojiId;
- 表情名称
@property (nonatomic, copy) NSString *emojiName;
- emojiCode - 表情编码
@property (nonatomic, copy) NSString *emojiCode;
- emojiImage - 表情图片
@property (nonatomic, strong) UIImage *emojiImage;
- emojiData - 图片数据
@property (nonatomic, strong) NSData *emojiData;
- packageId - 表情包Id
@property (nonatomic, copy) NSString *packageId;
BQMM/MMGif.h
- 表情id
@property (nonatomic, strong) NSString *imageId;
- 表情名称
@property (nonatomic, strong) NSString *text;
- 图片缩略图地址 静图
@property (nonatomic, strong) NSString *thumbImage;
- 图片缩略图地址 动图
@property (nonatomic, strong) NSString *gifThumbImage;
- 图片地址,可能是GIF、PNG、JPG格式
@property (nonatomic, strong) NSString *mainImage;
- 图片尺寸(pix)
@property (nonatomic, assign) CGSize size;
- 是否动画表情(GIF)
@property (nonatomic, assign) BOOL isAnimated;
BQMM/MMImageView.h
说明: 用于显示大表情和gif表情的控件
- 设置大表情
//emojiCode MMEmoji的emojiCode字段
- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode;
- (void)setImageWithEmojiCode:(NSString * _Nonnull)emojiCode completHandler:(void (^_Nullable)(BOOL success))handler;
- 设置gif表情
//urlString: MMGif的mainImage字段
//gifId: MMGif的imageId字段
- (void)setImageWithUrl:(NSString *)urlString gifId:(NSString *)gifId;
- (void)setImageWithUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId completHandler:(void (^_Nullable)(BOOL success))handler;
- 计算图片在给定的最大尺寸下的尺寸
//size: 图片的尺寸
//imgMaxSize: 给定的最大的尺寸
+ (CGSize)sizeForImageSize:(CGSize)size imgMaxSize: (CGSize)mSize;
- 重用时重置控件
- (void)prepareForReuse;
BQMM/MMTextParser.h
说明:文本消息解析器。
- parseMMText - 从text中解析所有
MMEmoji
,本地没有的emoji code会从服务器实时获取。completionHandler
是表情消息解析完成后的回调,参数textImgArray
类型可能是MMEmoji
或字符串。
+ (void)parseMMText:(NSString *)text completionHandler:(void(^)(NSArray *textImgArray))completionHandler;
- localParseMMText - 从
text
中解析本地已下载的Emoji
+ (void)localParseMMText:(NSString *)text completionHandler:(void(^)(NSArray *textImgArray))completionHandler;
- findEmojicodesResultFromMMText - 从
mmText
中检查出符合emojiCode
格式的result
数组
+ (NSArray<NSTextCheckingResult *> *)findEmojicodesResultFromMMText:(NSString *)mmText;
- emojiTypeWithEmojiCode - 根据emojiCode获取是大表情还是小表情
+ (EmojiType)emojiTypeWithEmojiCode:(NSString*)emojiCode;
BQMM/UITextView+BQMM.h
说明:对UITextView
的扩充,用于输入、显示及解析表情消息。
characterMMText - UITextView的内容解析成的纯文字,例如:你好[厉害]。
@property(nonatomic, assign, readonly, nonnull) NSString *characterMMText;
textImgArray - UITextView的内容解析出的MMEmoji对象 和 string的数组,例如:
@[@"你好", <Emoji*>]
@property(nonatomic, assign, readonly, nonnull) NSArray *textImgArray;
mmTextWithRange - 获取输入框中的某一段文字,返回表情消息
- (NSString *)mmTextWithRange:(NSRange)range;
BQMM_EXT/MMTextAttachment.h
说明:继承NSTextAttachment
,用于MMEmoji
的富文本显示
- emoji - 表情对象
@property (nonatomic, strong) MMEmoji *emoji;
- placeHolderImage - gif表情图片第一帧,大小为100px*100px,可用于编辑富文本消息时的gif表情显示。
- (UIImage *)placeHolderImage;
BQMM_EXT/MMTextParser.h
说明:实现textImageArray
、extData
、text
的互相转换,开源类。
- extDataWithTextImageArray - 将
textImageArray
转换成extData
+ (NSArray*)extDataWithTextImageArray:(NSArray*)textImageArray;
- extDataWithEmojiCode - 将单个
emojiCode
转换成extData
+ (NSArray*)extDataWithEmojiCode:(NSString*)emojiCode;
- stringWithExtData - 将
extData
转换成text
+ (NSString*)stringWithExtData:(NSArray*)extData;
- sizeForMMTextWithExtData - 计算展示图文混排所需size。
+ (CGSize)sizeForMMTextWithExtData:(NSArray*)extData
font:(UIFont *)font
maximumTextWidth:(CGFloat)maximumTextWidth;
- sizeForTextWithText - 计算展示纯文字所需size。
+ (CGSize)sizeForTextWithText:(NSString *)text
font:(UIFont *)font
maximumTextWidth:(CGFloat)maximumTextWidth;
BQMM_EXT/MMTextView.h
说明:用于显示富文本消息的控件,开源类。
- mmFont - 设置消息字体
@property (nonatomic,strong) UIFont *mmFont;
- mmTextColor - 设置消息字体颜色
@property (nonatomic,strong) UIColor *mmTextColor;
- setMmTextData - 设定视图文本,需要显示表情的地方如果本地有就显示,没有下载后显示。参数
extData
是一个二维数组,格式为@[@[@"emojiCode", @2],@[@"emojiCode", @1], @[@"text", @0]]
- (void)setMmTextData:(NSArray *)extData;
- setMmTextData - 设定视图文本,需要显示表情的地方如果本地有就显示,没有下载后显示。参数
extData
是一个二维数组,格式为@[@[@"emojiCode", @2], @[@"emojiCode", @1], @[@"text", @0]]
,completionHandler
是完成显示表情后的回调
- (void)setMmTextData:(NSArray*)extData
completionHandler:(void(^)(void))completionHandler;
- setURLAttributes - 将url和电话范围的内容设置成链接
(void)setURLAttributes;
BQMM_GIF/MMGifCell.h
说明:GIF表情搜索结果的展示Cell
- setData - 设置显示的GIF表情
(void)setData: (MMGif *)gif;
BQMM_GIF/MMGifManager.h
说明:GIF表情搜索功能管理类
- setSearchModeEnabled - 设置搜索模式的开启和关闭;指定输入控件
- (void)setSearchModeEnabled:(BOOL)enabled withInputView:
(UIResponder<uitextinput> *_Nullable)input;
</uitextinput>
- setSearchUiVisible - 设置是否显示搜索出的表情内容;指定表情内容的显示位置
(void)setSearchUiVisible:(BOOL)visible withAttatchedView:(UIView *_Nullable)attachedView;
- updateSearchModeAndSearchUIWithStatus - 通过
MMSearchModeStatus
管理搜索模式的开启和关闭及搜索内容的展示和收起(MMSearchModeStatus可自由调整)
(void)updateSearchModeAndSearchUIWithStatus:(MMSearchModeStatus)status;
typedef NS_OPTIONS (NSInteger, MMSearchModeStatus) {
MMSearchModeStatusKeyboardHide = 1 << 0, //收起键盘
MMSearchModeStatusInputEndEditing = 1 << 1, //收起键盘
MMSearchModeStatusInputBecomeEmpty = 1 << 2, //输入框清空
MMSearchModeStatusInputTextChange = 1 << 3, //输入框内容变化
MMSearchModeStatusGifMessageSent = 1 << 4, //发送了gif消息
MMSearchModeStatusShowTrendingTriggered = 1 << 5,//触发流行表情
MMSearchModeStatusGifsDataReceivedWithResult = 1 << 6, //收到gif数据
MMSearchModeStatusGifsDataReceivedWithEmptyResult = 1 << 7, //搜索结果为空
};