Skip to content

Commit 8d09cc5

Browse files
committed
Update FAQ how to hide AvatarView
1 parent 488e29b commit 8d09cc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Documentation/FAQs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at
3131
}
3232
```
3333

34-
If you return `CGSize.zero` from the `MessagesLayoutDelegate` method
35-
`avatarSize(for:MessageType,at:IndexPath,in:MessagesCollectionView)`, the `AvatarView`
36-
will not be visible for that cell.
34+
If you also like to remove the space the `AvatarView` occupies you have to change the properties
35+
`outgoingAvatarSize` or `incomingAvatarSize` of the `CellSizeCalculator` object for the respective message to `CGSize.zero`.
3736

3837
```Swift
39-
func avatarSize(for: MessageType, at: IndexPath, in: MessagesCollectionView) -> CGSize {
40-
return .zero
38+
if let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout {
39+
layout.textMessageSizeCalculator.outgoingAvatarSize = .zero
40+
layout.textMessageSizeCalculator.incomingAvatarSize = .zero
4141
}
4242
```
4343

0 commit comments

Comments
 (0)