我在聊天应用程序中使用jsqmessageviewcontroller。在我的应用程序中,当我发送url链接时,不会将消息显示为链接,而是显示为消息我尝试了此代码
- (UICollectionViewCell *)collectionView:(JSQMessagesCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
cell=nil;
if (cell == nil)
{
cell = (JSQMessagesCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
}
JSQMessage *msg = [self.arrChatMessages objectAtIndex:indexPath.item];
if ([msg.senderId isEqualToString:self.senderId]){
cell.textView.textColor = [UIColor whiteColor];
cell.cellTopLabel.textColor = [UIColor whiteColor];
}else{
cell.textView.textColor =[UIColor blackColor];
cell.cellTopLabel.textColor = [UIColor darkGrayColor];
}
cell.textView.linkTextAttributes = @{ NSForegroundColorAttributeName : cell.textView.textColor,
NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternSolid) };
return cell;
}
这是我的截图
请帮助我解决这个问题。