Reputation: 11
I have a CollectionView
to display array
of message, but I want the cells to start displaying from the bottom. Example is WhatsApp or Telegram App for iOS (new messages starts from the bottom and populate upwards).
I am trying to transform my collection view:
messageCollectionView.transform = CGAffineTransform.init(rotationAngle: (-(CGFloat)(Double.pi)))
And then transform collection cell at cellForItemAt :
cell.transform = self.messageCollectionView.transform
But when I insert a new cell, transform cell does not appear in the collection.
Upvotes: 1
Views: 1059
Reputation: 2632
I usually achieve the effect your trying to accomplish by inserting the cell at the last index with the animation of you choice.
To achieve this just utilize insertItems(at:)
method. For further reading follow apples documentation
Upvotes: 2
Reputation: 5665
To achieve this you're looking at creating a custom UICollectionViewLayout.
This answer should point you in the right direction: https://stackoverflow.com/a/31286238/346098
Also Apple provide a tutorial for creating custom layouts: https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/CreatingCustomLayouts/CreatingCustomLayouts.html
Upvotes: -1