当前知识库站点已不再维护。请移步新版知识库:https://help.rongcloud.cn/

输入扩展功能板的自定义,添加与移除。

输入扩展功能板的自定义,添加与移除
发布时间: 2015-07-31 09:59

回答:

参考Demo代码

RCDChatViewController.m

    /***********如何自定义面板功能***********************
//     自定义面板功能首先要继承RCConversationViewController,如现在所在的这个文件。
//     然后在viewDidLoad函数的super函数之后去编辑按钮:
//     插入到指定位置的方法如下:
     [self.chatSessionInputBarControl.pluginBoardView insertItemWithImage:imagePic
                                                                    title:title
                                                                  atIndex:0
                                                                      tag:101];

     删除指定位置的方法:

[self.chatSessionInputBarControl.pluginBoardView removeItemAtIndex:0];

     删除指定标签的方法:

 [self.chatSessionInputBarControl.pluginBoardView removeItemWithTag:101];

     删除所有:

[self.chatSessionInputBarControl.pluginBoardView removeAllItems];

     更换现有扩展项的图标和标题:

[self.chatSessionInputBarControl.pluginBoardView updateItemAtIndex:0 image:newImage title:newTitle];

     或者根据 tag 来更换

 [self.chatSessionInputBarControl.pluginBoardView updateItemWithTag:101 image:newImage title:newTitle];

    

以上所有的接口都在 RCPluginBoardView.h 可以查到。当编辑完扩展功能后,下一步就是要实现对扩展功能事件的处理,放开被注掉的函数 pluginBoardView:clickedItemWithTag: 在 super 之后加上自己的处理。