Skip to content

CollectionView Layout Customisation

Clement T edited this page Oct 16, 2015 · 1 revision

It is an experimental feature

If you do not like the default grid view layout, you can implement a custom UICollectionViewLayout object and set it to the picker by implementing assetsPickerController:collectionViewLayoutForContentSize:traitCollection: in the delegate.

In the custom layout object, you can dynamically return different item size, item spacing based on the content size and trait collection of the view controller. You may refer to the default layout object CTAssetsGridViewLayout.m for such implementation concept.

Theoretically this picker supports layout other than 'grid' view. (e.g. waterfall layout in the "Activity" of iOS's Photos app). Unfortunately I have no time to try it. If your app uses other layout, I am happy to see the result. Please also open an issue if you encounter any difficulties on doing so.