IGListKit
IGListKit copied to clipboard
Getting item size in custom layout
trafficstars
New issue checklist
- [x] I have reviewed the
READMEand docuxmentation - [x] I have searched existing issues and this is not a duplicate
How can I get value of - (CGSize)sizeForItemAtIndex:(NSInteger)index; method in my custom UICollectionViewLayout?
I have a similar issue where my custom UICollectionViewLayout does the size calculation to adapt to the screen (list vs grid), something I'm not sure I want to leave to the ListSectionController and where collectionContext doesn't have enough info anyway.
I am trying to do Pinterest layout Any Ideas are welcome
@jassimkm You can get item size from the adapter with layout delegate. Like this:
extension ViewController: CustomCollectionViewLayoutDelegate {
func sizeForItem(at indexPath: IndexPath) -> CGSize {
return adapter.sizeForItem(at: indexPath)
}
}