Q:

ios UICollectionView layout (margin and move of sections)

what I want is like this:

As you can see, the second section's first bubble is margined by some space in the left.
What I have now is:

I am using UICollectionView, and I think the answer should be something about UICollectionViewFlowLayout. So I want to know:
(1) how to make the even rows have the left margin
(2) how to make the even rows lifted up but a little after adding the left margin to it.
Thank you very much!! Please help me out!!

A:

Check if the Cell of the collection view is in an even row (indexPath.row % 2 == 0) in the cellForItemAtIndexPath method. Then add a padding to its position.

