mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
[Added] additionalTopContentInset property
This commit is contained in:
@@ -26,6 +26,9 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa
|
||||
- `scrollsToBottomOnFirstLayout` property to automatically scroll to the bottom of `MessagesCollectionView` on first load.
|
||||
[#213](https://github.com/MessageKit/MessageKit/pull/213) by [@FraDeliro](https://github.com/FraDeliro).
|
||||
|
||||
- `additionalTopContentInset` property to `MessagesColectionViewController` to allow users to account for extra subviews.
|
||||
[#218](https://github.com/MessageKit/MessageKit/pull/218) by [@SD10](https://github.com/SD10).
|
||||
|
||||
### Fixed
|
||||
|
||||
- `MessageInputBar` now correctly sizes itself when breaking its max height or pasting in large amounts of text
|
||||
|
||||
@@ -34,6 +34,13 @@ open class MessagesViewController: UIViewController {
|
||||
|
||||
open var scrollsToBottomOnFirstLayout: Bool = false
|
||||
|
||||
open var additionalTopContentInset: CGFloat = 0 {
|
||||
didSet {
|
||||
let inset = topLayoutGuide.length + additionalTopContentInset
|
||||
messagesCollectionView.contentInset.top = inset
|
||||
}
|
||||
}
|
||||
|
||||
private var isFirstLayout: Bool = true
|
||||
|
||||
open override var canBecomeFirstResponder: Bool {
|
||||
@@ -69,6 +76,7 @@ open class MessagesViewController: UIViewController {
|
||||
// Hack to prevent animation of the contentInset after viewDidAppear
|
||||
if isFirstLayout {
|
||||
addKeyboardObservers()
|
||||
messagesCollectionView.contentInset.top = additionalTopContentInset + topLayoutGuide.length
|
||||
messagesCollectionView.contentInset.bottom = messageInputBar.frame.height
|
||||
messagesCollectionView.scrollIndicatorInsets.bottom = messageInputBar.frame.height
|
||||
isFirstLayout = false
|
||||
|
||||
Reference in New Issue
Block a user