Reproducing Popular iOS Controls - Part 7: | Ray Wenderlich Videos

In this video you'll learn how to create a custom flow layout.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5298-reproducing-popular-ios-controls/lessons/7

i implemented func collectionView(_:layout:sizeForItemAt:) in UICollectionViewDelegate, i see itemSize is (72,72) but func file LensFlowLayout.swift, private func changeLayoutAttributes, the itemSize is (50,50). Can you help me explain it, please?

@leamars Can you please help with this when you get a chance? Thank you - much appreciated! :]

Not sure why that’s happening to you, when I step through with the debugger, the size of each item in changeLayoutAttributes seems to be 72 x 72.
image

Perhaps I don’t fully understand your question.

Hey Lea, Good job on the tutorial, really love to solve and write custom flow layouts which involves good math which I feel that is the crux and challenging part. While the code is in downloaded materials, I felt the focus should more be in how to write one and customize. In the part which involves math you read the equations by referring to slide behind, which I didn’t understand clearly, because I feel math should never be just spoken, it has to be done and calculated with real numbers. You could’ve taken collection view width as 300, and cell width as 30 each, then it would’ve been more better and clear to calculate
and understand scaled distance and importance of its ratio. I know this is not a math class and there are other tutorials on writing custom flow layouts but none of them explain anatomy of collection view and calculating its attributes. I sincerely request you to append another video to this tutorial to completely understand in-depth analysis of Custom layout calculations asap which helps a lot of people. Happy learning :slight_smile:

@leamars Can you please help with this when you get a chance? Thank you - much appreciated! :]