任何人都可以知道在传入的媒体上显示错误的泡泡。短信气泡工作正常
JSQMessagesBubbleImageFactory *bubbleFactory = [JSQMessagesBubbleImageFactory new];
self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleRedColor]];
self.incomingBubbleImageData = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleBlueColor]];
答案 0 :(得分:0)
- (id<JSQMessageData>)collectionView:(JSQMessagesCollectionView *)collectionView messageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
JSQMessage *message = [self.chatArray objectAtIndex:indexPath.item];
// Determine if the message has media content
if (message.isMediaMessage)
{
// Incoming or outgoing message?
if (![message.senderId isEqualToString:self.senderId]) {
[((JSQMediaItem *)message.media) setAppliesMediaViewMaskAsOutgoing:NO]; // Override default setting to allow incoming media message
}
}
return message;
}
得到Here
的答案答案 1 :(得分:0)
首先,我必须告诉你,现在你应该明智地使用这个库,或者使用另一个库。来源 - officially deprecated
您必须记住您的jsqmessagemedia
类型何时是传出或传入消息对象
如果您的jsqmessage
类型为jsqphotomediaitem
,则必须在将其附加到消息数组之前进行如下配置
JSQPhotoMediaItem *mediaItem = [[JSQPhotoMediaItem alloc]initWithImage:yourImage];
if(yourMessageObjectIsOutGoing == YES){
mediaItem.appliesMediaViewMaskAsOutgoing = YES;
}else{
mediaItem.appliesMediaViewMaskAsOutgoing = NO;
}
arrMessages.append(mediaItem)
[self.collectionView reloadData];
同样适用于任何媒体对象,如JSQVideoMediaItem