i'm learning iOS with Swift, and now i wanted to create simple messenger app (very very simple version of WhatsApp). I've looked through all collection view video tutorials, but i still cannot understand how to create a layout, where cells will be on two sides of the screen (two cells couldn't be in one row). So as far as i understand, i should go with flow layout. I override layoutAttributesForElementsInRect like this:
override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? {
let attributes = super.layoutAttributesForElementsInRect(rect) as! [UICollectionViewLayoutAttributes]
for attribute in attributes {
attribute.frame.origin.x = collectionView!.bounds.width - attribute.frame.width
}
return attributes
}
And now my cells lay under each other (for example i have 50 cells, but i could see only 10 with 5 cells in depth).
EDIT: As you can see, 5 cells lay under each other in each row, so totally i got 10 rows, not 50.
And i want to see all 50 cells from right side.
So could somebody give any advice how can i implement this layout. Thanks for any help!


yvalues. - NRitH