What you are experiencing is a normal cell placement when using the UICollectionViewFlowLayout
.
You have to tweak the layout attributes being returned by the flow layout. To do so, override the layoutAttributesForElementsInRect:
method and any of the methods that return layout attributes. Modify the attributes provided by the parent class, and then return them. The attribute you have to modify is frame
.
A good example of doing it is a sample code from Apple - Custom Layouts: A Worked Example
Update after attaching implementation of the layout.
Looks like in the layoutAttributesForItemAtIndexPath:
method you are not adjusting the frame
for first item (index 0
). You are returning the attributes you get from parent class. Change the frame's origin.y
to 0
for item 0
.