JSQMessageViewController textview不显示链接

时间:2018-10-02 07:30:41

标签: ios objective-c jsqmessagesviewcontroller

我正在使用jsqmessageviewcontroller进行聊天application.in我的应用程序中,我发送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 个答案:

没有答案