会话列表
新建¶
新建一个继承于 RCConversationListViewController
的控制器, 初始化控制器对象并设置需要显示的会话类型和需要聚合显示的会话类型
设置在列表中需要显示的会话类型
参数 | 类型 | 说明 |
---|---|---|
conversationTypeArray | NSArray | 列表中需要显示的会话类型数组 |
注意
需要将 RCConversationType
转为 NSNumber
构建 NSArray
- (void)setDisplayConversationTypes:(NSArray *)conversationTypeArray;
设置在列表中需要聚合为一条显示的会话类型
参数 | 类型 | 说明 |
---|---|---|
conversationTypeArray | NSArray | 列表中需要聚合为一条显示的会话类型数组 |
注意
需要将 RCConversationType
转为 NSNumber
构建 NSArray
- (void)setCollectionConversationType:(NSArray *)conversationTypeArray;
代码示例:
RCDChatListViewController *temp = [[RCDChatListViewController alloc] init];
NSArray *array = [NSArray arrayWithObject:[NSNumber numberWithInt:model.conversationType]];
[temp setDisplayConversationTypes:array];
[temp setCollectionConversationType:nil];
temp.isEnteredToCollectionViewController = YES;
[self.navigationController pushViewController:temp animated:YES];
跳转¶
在继承 RCConversationListViewController
的会话列表中加入以下代码,即可点击进入聊天会话界面。
注意
必须在 push
之前传入 conversationType
和 targetId
。
//重写RCConversationListViewController的onSelectedTableRow事件
- (void)onSelectedTableRow:(RCConversationModelType)conversationModelType
conversationModel:(RCConversationModel *)model
atIndexPath:(NSIndexPath *)indexPath {
RCConversationViewController *conversationVC = [[RCConversationViewController alloc] init];
conversationVC.conversationType = model.conversationType;
conversationVC.targetId = model.targetId;
conversationVC.title = @"想显示的会话标题";
[self.navigationController pushViewController:conversationVC animated:YES];
}