我有一个消息传递应用程序,问题在于第一条消息不可见,当我拖动集合视图以查看可以看到的最上面的消息时,但是当我松开手指时,集合视图会跳回并隐藏屏幕顶部的前5条消息
从图像中我们可以看到有一条消息(实际上顶部有5条消息),但是我必须拖动集合视图以查看这些消息。我以为集合视图的尺寸实际上比屏幕大,但是collectionView.frame.height
和UIScreen.main.bounds.height
的高度相同,可以吗? 。
这是我用来设置集合视图的代码:
/// Function that configures the ChatViewController collection view
private func configureCollectionView() {
collectionView?.backgroundColor = Theme.current.chatGeneralBackground
collectionView?.alwaysBounceVertical = true
collectionView?.keyboardDismissMode = .onDrag
// Register the chat cell and the loading cellx`
collectionView?.register(ChatCell.self,forCellWithReuseIdentifier: chatCellIdentifier)
collectionView?.register(LoadingCollectionViewCell.self,forCellWithReuseIdentifier: loadingCellIdentifier)
// Initialize the original height of the collection view
collectionViewOriginalHeight = collectionView.frame.height
}
我在做什么错了?