mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Add padding info in the example proj for the InputBar
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user