I am using JSQMessageViewControllers library to implement the chat view. However, I want to hide the avatar image in the chat.
According to the following documentation. http://cocoadocs.org/docsets/JSQMessagesViewController/7.2.0/Protocols/JSQMessagesCollectionViewDataSource.html#//api/name/collectionView:avatarImageDataForItemAtIndexPath:
I will just need to return nil in the following function.
override func collectionView(collectionView: JSQMessagesCollectionView!, avatarImageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageAvatarImageDataSource! {
return nil
}
However, after returning nil. It has white spaces for each message for the original avatar location. chat image
How can we remove the white spaces?
I solved the problem by setting the following properties in my JSQMessageViewController subclass to remove the white spaces.
collectionView?.collectionViewLayout.incomingAvatarViewSize = CGSizeZero
collectionView?.collectionViewLayout.outgoingAvatarViewSize = CGSizeZero