2016-07-18 4 views
3

私はJSQMessagesViewControllerを使用していますが、送信メッセージを白にします。私は、着信メッセージのテキストが白である間に、発信メッセージテキストの色が黒になるようにテキストの色を変更することができました。ただし、リンクが送信されるたびに、送信側ではリンクテキストはまだ白で、背景の画像と見えない部分にブレンドされます。リンクテキストの色を変更するにはどうすればよいですか?この方法ではjsqmessagesviewcontrollerリンクカラー

答えて

4

あなたがリンク

 cell.textView?.linkTextAttributes = [NSForegroundColorAttributeName : UIColor.blueColor()] //this is the color of the links 

の色を変更することができ、着信テキストまたは発信テキストこのコードの

override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 

    let cell : JSQMessagesCollectionViewCell = super.collectionView(collectionView, cellForItemAtIndexPath: indexPath) as! JSQMessagesCollectionViewCell 


    let msg : JSQMessage = (self.demoData?.messages[indexPath.row])! as! JSQMessage 


    if (!msg.isMediaMessage) { 

     if(msg.senderId == self.senderId()) 
     { 
      cell.textView?.textColor = UIColor.blackColor() //change this color for your messages 
     }else 
     { 
      cell.textView?.textColor = UIColor.whiteColor() //change this color for other people message 
     } 

     cell.textView?.linkTextAttributes = [NSForegroundColorAttributeName : UIColor.blueColor()] //this is the color of the links 

    } 

    return cell; 

} 

の色を変更私はこれがあなた

を役に立てば幸い
関連する問題