By default, when you are using the flow layout in a collection view, cells are centered vertically. Is there a way to change this alignment ?
The UICollectionViewFlowLayout
class is derived from the UICollectionViewLayout
base class. And if you look at the documentation for that, you'll see there are a number of methods you can override, the most likely candidate being layoutAttributesForItemAtIndexPath:
.
If you override that method, you could let it call its super implementation, and then adjust the properties of the returned UICollectionViewLayoutAttributes
object. Specifically, you'll likely need to adjust the frame
property to reposition the item so it's no longer centered.