-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make collectioview show messages immediately #40
Comments
@Sabellus Hi, thank you for your question. First of all. If I correctly understood your description of func keyboardWillChangeFrame(info: KeyboardInfo) {
// ....
let keyboardOffset = max(0, view.safeAreaLayoutGuide.layoutFrame.maxY - view.keyboardLayoutGuide.layoutFrame.minY)
// ....
} In regard to message population as far as I remember push animation creates an extra animation loop so automatic inset value changes also happen with animation. As far as i remember thats why you need to populate collection and set thouse insets yourself at first time outside of that animation curve. So you want to do in your view controller something like: private var isFirsAppearance = true
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
// Hack to prevent animation of the contentInset of first appearance. The same is used in MessageKit
if isFirsAppearance {
isFirsAppearance = false
setupInsets()
let initialCells = eventHandler.getInitialCells()
if !initialCells.isEmpty {
processUpdates(with: initialCells, animated: false, ignoreInterfaceActions: true)
}
}
} |
What exactly should I do?
|
@Sabellus Yep you understand in general fine. But you should understand I am giving you a theoretical code. I can not write it for you. I can only give you some directions. Keyboard appearance function will look someting like:
I can not guarantee that is the only place you need changes. But I know that it is possible what you want to achieve. |
Appreciate your help! It works ❤ |
You are very welcome @Sabellus. Best of luck |
What needs to be done so that when the chatviewcontroller push-navigates, the data is already ready?
An empty collection is shown. then messages? Like no spawn animation.
i played with it
collectionView.contentInsetAdjustmentBehavior = .always
changed to this
collectionView.contentInsetAdjustmentBehavior = .never
then the collection of elements is loaded immediately
but there are a number of artifacts associated with tabbar navigation and inputAccessoryView
inputAccessoryView twitches and disappears and reappears 2 times
I attach screenshots
please help me how to do this, thanks
The text was updated successfully, but these errors were encountered: