UICollectionView paging with custom page width and zoom

paging-collection-view-thumbnailLGHorizontalLinearFlowLayout – UICollectionView flow layout subclass written in Objective-C and Swift 2.0 that supports custom page width and zoom/scale of center page/cell. Scale offset and minimum scale factor parameters can be used to fine tune the effect.

Sample project is available on GitHub:
https://github.com/lukagabric/LGLinearFlow

If you liked this blog post I’d appreciate if you followed me on Twitter

Related Post

Remember to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someone

10 thoughts on “UICollectionView paging with custom page width and zoom

  1. hello, your sample is really nice and beautiful
    But how can I modify cell attributes, for example, background color or font size when the cell is moved away from the center of collectionView ? should I modify the property of cell? or do it in delegate?

    1. You could do it with scrollViewDidScroll delegate method and for each visible cell update with the offset from center:

      1. Amazing !
        Sometimes I might think that the length of complex code(UIKit Related, especially when calculating bounds or position) is is proportional to performance, except for Core Foundation. I was totally wrong.
        Thanks a lot!

  2. Awesome example! I was looking for something like that for tvOS app.
    Thanks for Swift version

  3. Hi,

    Thanks for code. It helped me a lot as I’m a new in implementing custom flow.
    But I met the issue. When invalidateLayout(with context:) it takes incorrect itemSize.
    Because I implemented collectionView(_:layout:sizeForItemAt:) in my view controller.

    Item’ size should be based on collectionView’ frame. In viewDidLoad() collectionView’ frame could be incorrect ’cause the view is only loaded to the memory.
    So what is the solution?

    Thanks

Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *