更新时间: 2021-03-08
# 功能描述
SDK 支持添加、修改、删除扩展板上的每一个扩展项,包括修改扩展项的图片、文案以及点击之后的响应事件处理。
SDK 默认的扩展项的唯一标示符为 1XXX,我们建议您在自定义扩展功能时不要选用 1XXX,以免与 SDK 预留的扩展项唯一标示符重复。
# 内置扩展项
# 扩展项介绍
常用扩展项介绍:
定义名 | Tag 值 | 说明 |
---|---|---|
PLUGIN_BOARD_ITEM_ALBUM_TAG | 1001 | 相册 |
PLUGIN_BOARD_ITEM_CAMERA_TAG | 1002 | 拍照 |
PLUGIN_BOARD_ITEM_LOCATION_TAG | 1003 | 位置 |
PLUGIN_BOARD_ITEM_FILE_TAG | 1006 | 文件 |
更多标识定义请参考 RCChatSessionInputBarControl
类
# 常用扩展项
- 添加文件功能
加号区域增加发送文件功能,SDK 中已经默认实现了该功能,但是为了 SDK 向后兼容性,目前 SDK 默认不开启该入口,可以参考以下代码在加号区域中增加发送文件功能。
UIImage *imageFile = [RCKitUtility imageNamed:@"actionbar_file_icon" ofBundle:@"RongCloud.bundle"]; RCPluginBoardView *pluginBoardView = self.chatSessionInputBarControl.pluginBoardView; [pluginBoardView insertItemWithImage:imageFile title:NSLocalizedStringFromTable(@"File", @"RongCloudKit", nil) atIndex:3 tag:PLUGIN_BOARD_ITEM_FILE_TAG];
已复制
1
2
3
4
5
6
7
2
3
4
5
6
7
- 添加音视频功能
音视频功能需要在 开发者后台 (opens new window) 开通音视频服务,SDK 会自动增加音视频通话扩展项。
# 添加扩展项
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
image | UIImage | 是 | 扩展项的展示图片 |
title | NSString | 是 | 扩展项的展示标题 |
index | NSInteger | 是 | 需要添加到的索引值 |
tag | NSInteger | 是 | 扩展项的唯一标示符 |
代码示例
[self.chatSessionInputBarControl.pluginBoardView insertItemWithImage:[UIImage imageNamed:@"poke_plugin_item"] title:@"示例1" atIndex:4 tag:2001];
已复制
1
2
3
4
2
3
4
# 更新指定扩展项
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
image | UIImage | 是 | 扩展项的展示图片 |
title | NSString | 是 | 扩展项的展示标题 |
tag | NSInteger | 是 | 扩展项的唯一标示符 |
代码示例
[self.chatSessionInputBarControl.pluginBoardView updateItemWithTag:101 image:newImage title:newTitle];
已复制
1
# 删除指定扩展项
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
image | UIImage | 是 | 扩展项的展示图片 |
title | NSString | 是 | 扩展项的展示标题 |
tag | NSInteger | 是 | 扩展项的唯一标示符 |
代码示例
[self.chatSessionInputBarControl.pluginBoardView removeItemWithTag:PLUGIN_BOARD_ITEM_RED_PACKET_TAG];
已复制
1
# 点击扩展项
参数说明
参数 | 类型 | 说明 |
---|---|---|
pluginBoardView | RCPluginBoardView | 输入扩展功能板View |
tag | NSInteger | 输入扩展功能(Item)的唯一标示 |
回调方法
- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag;
已复制
1