I have a UICollectionView
object of size (320,500).
I need a to create the UICollectionView
in such a way that contents are vertically centred. Means if total size of the content is (100,100) then the cells should drawing itself in a rect (0,200):(320,300). that is 50 above and 50 below the vertical centre at 250.
Problem is The number of cells and size of cells is decided only at runtime. For example if the text with in the cell can be 1 line is of size ~ (100,50) . If it is 4 lines size will be ~ (100,200). So it is only after I have run collectionView:sizeForItemAtIndexPath:
for the last cell that I can determine what should be starting position for first cell.
Any starting suggestion how I should approach this problem. Even if I subclass Flowlayout
how will I know the position of the first cell before I draw the last one ?