NIMkit解析1
2020-01-08 14:04:54 1 举报
对NIMkit的tableview配置cell到实际设置cell上的ui处的调用顺序
作者其他创作
大纲/内容
id<NIMSessionContentConfig>config = [[NIMSessionContentConfigFactory sharedFacotry] configBy:model.message]; NSString *cellContent = [config cellContent:model.message]; return cellContent.length ? cellContent : @\"NIMSessionUnknowContentView\";
id<NIMCellLayoutConfig> layoutConfig = [[NIMKit sharedKit] layoutConfig]; NSString *identity = [layoutConfig cellContent:model]; NIMMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:identity];
NIMTextContentConfig<NIMSessionContentConfig>
- (NSString *)cellContent:(NIMMessage *)message
NIMMessageType type = message.messageType; id<NIMSessionContentConfig>config = [_dict objectForKey:@(type)];
UITableViewCell *cell = nil; id model = [[self.interactor items] objectAtIndex:indexPath.row]; if ([model isKindOfClass:[NIMMessageModel class]]) { cell = [self.cellFactory cellInTable:tableView forMessageMode:model]; [(NIMMessageCell *)cell setDelegate:self.delegate]; [(NIMMessageCell *)cell refreshData:model]; // 刷新控件以及控件上的数据 } else if ([model isKindOfClass:[NIMTimestampModel class]]) { cell = [self.cellFactory cellInTable:tableView forTimeModel:model]; }
NIMMessageCellFactory
-(NIMMessageCell *)cellInTable:(UITableView *)tableView forMessageMode:(NIMMessageModel *)model
- (NIMSessionTimestampCell *)cellInTable:(UITableView *)tableView forTimeModel:(NIMTimestampModel *)model
return @\"NIMSessionTextContentView\";
NIMCellLayoutConfig<NIMCellLayoutConfig>
- (NSString *)cellContent:(NIMMessageModel *)model
NIMSessionContentConfigFactory
- (id<NIMSessionContentConfig>)configBy:(NIMMessage *)message
id<NIMSessionInteractor> interactor;id<NIMMessageCellDelegate> delegate;NIMMessageCellFactory *cellFactory
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
0 条评论
下一页