Add padding info in the example proj for the InputBar

This commit is contained in:
Kino
2020-05-26 20:37:57 -07:00
parent 7ea2dee017
commit ccc26481c7
@@ -129,7 +129,6 @@ final class AdvancedExampleViewController: ChatViewController {
messageInputBar.sendButton.image = #imageLiteral(resourceName: "ic_up")
messageInputBar.sendButton.title = nil
messageInputBar.sendButton.imageView?.layer.cornerRadius = 16
messageInputBar.middleContentViewPadding.right = -38
let charCountButton = InputBarButtonItem()
.configure {
$0.title = "0/140"
@@ -148,7 +147,9 @@ final class AdvancedExampleViewController: ChatViewController {
item.setTitleColor(color, for: .normal)
}
let bottomItems = [.flexibleSpace, charCountButton]
messageInputBar.middleContentViewPadding.bottom = 8
configureInputBarPadding()
messageInputBar.setStackViewItems(bottomItems, forStack: .bottom, animated: false)
// This just adds some more flare
@@ -164,6 +165,22 @@ final class AdvancedExampleViewController: ChatViewController {
}
}
/// The input bar will autosize based on the contained text, but we can add padding to adjust the height or width if neccesary
/// See the InputBar diagram here to visualize how each of these would take effect:
/// https://raw.githubusercontent.com/MessageKit/MessageKit/master/Assets/InputBarAccessoryViewLayout.png
private func configureInputBarPadding() {
// Entire InputBar padding
messageInputBar.padding.bottom = 8
// or MiddleContentView padding
messageInputBar.middleContentViewPadding.right = -38
// or InputTextView padding
messageInputBar.inputTextView.textContainerInset.bottom = 8
}
// MARK: - Helpers
func isTimeLabelVisible(at indexPath: IndexPath) -> Bool {