MessageKit Version: 0.13.1
iOS Version(s): All
Swift Version: Swift4
Devices/Simulators: All
Reproducible in ChatExample? (Yes/No): Yes
Unable to create a custom chat bubble design view with texts, images and buttons.
I am looking to add a custom chat bubble design view which mat contain texts, images and button
@anandatswayam A few things you'll need to do (this is the path of least resistance):
configure method.cellForItem(...) (make sure to call cell.configure heresizeForItem(...)func messageStyle(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageStyle {
let closure = { (view: MessageContainerView) in
view.layer.cornerRadius = 15.0
view.layer.borderWidth = 1.0
view.layer.borderColor = UIColor.gray.cgColor
view.layer.backgroundColor = UIColor.white.cgColor
}
return .custom(closure)
}
Hopefully I'm not missing anything!
You have two options for this in the latest version of MessageKit. You can either:
MessageCollectionViewCell which is a pure wrapper on UICollectionViewCellMessageContentCell which has the AvatarView, messageTopLabel, messageBottomLabel, cellTopLabel, and an empty MessageContainerViewYou would be responsible for returning a CellSizeCalculator to size any of these new cells in the layout object:
If you need to create a different "kind" of message, ie) passing different message content, you can use the MessageKind.custom(Any?) case
@benhas999 please do not create a new issue #844 while also adding the same query to another thread.
Sent with GitHawk
@SD10
I've find some exemples with MessageCollectionViewCell, but it didn't find any examples with MessageContentCell did you know where I can find some ?
I've try to implement MessageContentCell in the same way as MessageCollectionViewCell, but I didn't succeed because I use a XIB
It is possible to implement it on a XIB ?
Thanks for your help guys
Most helpful comment
@anandatswayam A few things you'll need to do (this is the path of least resistance):
configuremethod.cellForItem(...)(make sure to callcell.configureheresizeForItem(...)Hopefully I'm not missing anything!