mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Add delegate and adjust layout
This commit is contained in:
@@ -97,6 +97,11 @@ final class AdvancedExampleViewController: ChatViewController {
|
||||
layout?.setMessageIncomingAvatarSize(CGSize(width: 30, height: 30))
|
||||
layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: -outgoingAvatarOverlap, left: -18, bottom: outgoingAvatarOverlap, right: 18))
|
||||
|
||||
layout?.setMessageIncomingAccessoryViewSize(CGSize(width: 30, height: 30))
|
||||
layout?.setMessageIncomingAccessoryViewPadding(UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 0))
|
||||
layout?.setMessageOutgoingAccessoryViewSize(CGSize(width: 30, height: 30))
|
||||
layout?.setMessageOutgoingAccessoryViewPadding(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 8))
|
||||
|
||||
messagesCollectionView.messagesLayoutDelegate = self
|
||||
messagesCollectionView.messagesDisplayDelegate = self
|
||||
}
|
||||
@@ -311,6 +316,14 @@ extension AdvancedExampleViewController: MessagesDisplayDelegate {
|
||||
avatarView.layer.borderColor = UIColor.primaryColor.cgColor
|
||||
}
|
||||
|
||||
func configureAccessoryView(_ accessoryView: UIView, for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) {
|
||||
let button = UIButton(type: .infoLight)
|
||||
button.tintColor = .primaryColor
|
||||
accessoryView.addSubview(button)
|
||||
button.frame = accessoryView.bounds
|
||||
button.isUserInteractionEnabled = false // respond to accessoryView tap through `MessageCellDelegate`
|
||||
}
|
||||
|
||||
// MARK: - Location Messages
|
||||
|
||||
func annotationViewForLocation(message: MessageType, at indexPath: IndexPath, in messageCollectionView: MessagesCollectionView) -> MKAnnotationView? {
|
||||
|
||||
Reference in New Issue
Block a user