That is my customized cell:
class DocumentCollectionViewCell: MessageContentCell {
// ...
override init(body _: CGRect) {
tremendous.init(body: .zero)
setupView()
}
required init?(coder _: NSCoder) {
nil
}
func configure(
message: ChatMessageable,
indexPath: IndexPath,
view: MessagesCollectionView,
theme: Themeable,
isMe: Bool
) {
// ...
configure(with: message, at: indexPath, and: view)
}
non-public func setupView() {
// ...
}
}
and its calculator:
class DocumentCollectionViewCellSizeCalculator: MessageSizeCalculator {
non-public let message: ChatMessageable
non-public var measurement: CGSize {
guard let structure = structure as? MessagesCollectionViewFlowLayout, let attachment = message.attachment else {
return .zero
}
let top = attachment.sort.isDocument ? 60.0 : 110.0
return CGSize(width: structure.itemWidth, top: top)
}
// MARK: - Initialization
init(message: ChatMessageable, structure: MessagesCollectionViewFlowLayout?) {
self.message = message
tremendous.init(structure: structure)
outgoingAvatarSize = .zero
incomingMessagePadding = UIEdgeInsets(prime: 0, left: 4, backside: -15, proper: 30) //doesnt work
outgoingMessagePadding = UIEdgeInsets(prime: 0, left: 30, backside: -15, proper: 4) //doesnt work
}
// MARK: - Overriden
override func messageContainerSize(for _: MessageType) -> CGSize {
measurement
}
override func sizeForItem(at _: IndexPath) -> CGSize {
measurement
}
}
And it appear to be this:
Pictures are my customized cells. No matter I do it doesnt change the area between them. Why? It’s only utilized for predefined cells. Not for my customized ones. Why?
In my Controller, the next technique:
func messageBottomLabelHeight(for message: MessageType, at _: IndexPath, in _: MessagesCollectionView) -> CGFloat {
16
}
does not change something for my customized cells, in reverse to predefined cells.