It can be a little tricky dealing with insets and collectionContext.containerSize. The container width doesn't account for insets, so if you have the following setup:
insets of 10, 10, 10, 10320If your size method looks like
- (CGSize)sizeForItemAtIndex:(NSInteger)index {
return CGSizeMake(self.collectionContext.containerSize.width, 50);
}
UICollectionViewFlowLayout will error b/c the item width is 320 but layout adds left/right insets, making the total item width 340.
Maybe we should have a containerInsetSizeForSectionController: method that returns the container size minus insets?
what about collectionContext.insetContainerSize ?
@jessesquires only thing we have to add is the section controller b/c each section controller is responsible for their own inset property
Can we verify this is correctly calculated on iOS 9?
Inset were applied incorrectly for me.
I noticed a issue some time ago but I don't have a phone with iOS 9 to reproduce at the moment.
@racer1988 -- this work hasn't been completed. do you want to submit a PR?
@jessesquires If it is not done after the Christmas Holiday, I may try.
I am not a good OBJ-C programmer, I am Swift "onlyish"
but I will have a look if not done in some weeks.
Thanks! :D
@racer1988 Are you still interested in working on this one?
@zhubofei Hi! I did not start, and I might not have the time for a while.
So if you want to take it, go on
Most helpful comment
what about
collectionContext.insetContainerSize?