@@ -42,6 +42,7 @@ open class MessageContentCell: MessageCollectionViewCell {
4242 open var cellTopLabel : InsetLabel = {
4343 let label = InsetLabel ( )
4444 label. numberOfLines = 0
45+ label. textAlignment = . center
4546 return label
4647 } ( )
4748
@@ -94,10 +95,10 @@ open class MessageContentCell: MessageCollectionViewCell {
9495 guard let attributes = layoutAttributes as? MessagesCollectionViewLayoutAttributes else { return }
9596 // Call this before other laying out other subviews
9697 layoutMessageContainerView ( with: attributes)
97- layoutAvatarView ( with: attributes)
9898 layoutBottomLabel ( with: attributes)
9999 layoutCellTopLabel ( with: attributes)
100100 layoutMessageTopLabel ( with: attributes)
101+ layoutAvatarView ( with: attributes)
101102 }
102103
103104 /// Used to configure the cell.
@@ -184,12 +185,18 @@ open class MessageContentCell: MessageCollectionViewCell {
184185 }
185186
186187 switch attributes. avatarPosition. vertical {
188+ case . messageLabelTop:
189+ origin. y = messageTopLabel. frame. minY
187190 case . messageTop: // Needs messageContainerView frame to be set
188191 origin. y = messageContainerView. frame. minY
189192 case . messageBottom: // Needs messageContainerView frame to be set
190193 origin. y = messageContainerView. frame. maxY - attributes. avatarSize. height
191194 case . messageCenter: // Needs messageContainerView frame to be set
192195 origin. y = messageContainerView. frame. midY - ( attributes. avatarSize. height/ 2 )
196+ case . cellBottom:
197+ origin. y = attributes. frame. height - attributes. avatarSize. height
198+ default :
199+ break
193200 }
194201
195202 avatarView. frame = CGRect ( origin: origin, size: attributes. avatarSize)
@@ -220,9 +227,6 @@ open class MessageContentCell: MessageCollectionViewCell {
220227 open func layoutCellTopLabel( with attributes: MessagesCollectionViewLayoutAttributes ) {
221228 guard attributes. cellTopLabelSize != . zero else { return }
222229
223- cellTopLabel. textAlignment = attributes. cellTopLabelAlignment. textAlignment
224- cellTopLabel. textInsets = attributes. cellTopLabelAlignment. textInsets
225-
226230 cellTopLabel. frame = CGRect ( origin: . zero, size: attributes. cellTopLabelSize)
227231 }
228232
0 commit comments