From 512d2a9394ac1cbc053cf5cfcec8db5ecca9e3c2 Mon Sep 17 00:00:00 2001 From: Jesse Squires Date: Sun, 23 Nov 2014 16:29:19 -0800 Subject: [PATCH] fix semantics regarding avatarPlaceholderImage and avatarHighlightedImage. close #624 --- .../Controllers/JSQMessagesViewController.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/JSQMessagesViewController/Controllers/JSQMessagesViewController.m b/JSQMessagesViewController/Controllers/JSQMessagesViewController.m index a995fb056..5ae0856b6 100644 --- a/JSQMessagesViewController/Controllers/JSQMessagesViewController.m +++ b/JSQMessagesViewController/Controllers/JSQMessagesViewController.m @@ -467,8 +467,16 @@ - (UICollectionViewCell *)collectionView:(JSQMessagesCollectionView *)collection if (needsAvatar) { avatarImageDataSource = [collectionView.dataSource collectionView:collectionView avatarImageDataForItemAtIndexPath:indexPath]; if (avatarImageDataSource != nil) { - cell.avatarImageView.image = [avatarImageDataSource avatarImage] ?: [avatarImageDataSource avatarPlaceholderImage]; - cell.avatarImageView.highlightedImage = [avatarImageDataSource avatarHighlightedImage]; + + UIImage *avatarImage = [avatarImageDataSource avatarImage]; + if (avatarImage == nil) { + cell.avatarImageView.image = [avatarImageDataSource avatarPlaceholderImage]; + cell.avatarImageView.highlightedImage = nil; + } + else { + cell.avatarImageView.image = avatarImage; + cell.avatarImageView.highlightedImage = [avatarImageDataSource avatarHighlightedImage]; + } } }