代码之家  ›  专栏  ›  技术社区  ›  Jigar

jsqMessageViewControllertextView不显示链接

  •  0
  • Jigar  · 技术社区  · 8 年前

    我在聊天应用程序中使用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;
    }
    

    这是我的截图

    enter image description here

    请帮助我解决这个问题。

    0 回复  |  直到 8 年前
    推荐文章