From 8d09cc5c702ab261a2da941d9eb750f8aae2484d Mon Sep 17 00:00:00 2001 From: Jan Weinkauff Date: Sat, 5 May 2018 15:12:29 +0200 Subject: [PATCH] Update FAQ how to hide AvatarView --- Documentation/FAQs.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/FAQs.md b/Documentation/FAQs.md index 328ec18f..2e2e663d 100644 --- a/Documentation/FAQs.md +++ b/Documentation/FAQs.md @@ -31,13 +31,13 @@ func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at } ``` -If you return `CGSize.zero` from the `MessagesLayoutDelegate` method -`avatarSize(for:MessageType,at:IndexPath,in:MessagesCollectionView)`, the `AvatarView` -will not be visible for that cell. +If you also like to remove the space the `AvatarView` occupies you have to change the properties +`outgoingAvatarSize` or `incomingAvatarSize` of the `CellSizeCalculator` object for the respective message to `CGSize.zero`. ```Swift -func avatarSize(for: MessageType, at: IndexPath, in: MessagesCollectionView) -> CGSize { - return .zero +if let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout { + layout.textMessageSizeCalculator.outgoingAvatarSize = .zero + layout.textMessageSizeCalculator.incomingAvatarSize = .zero } ```