I am using custom UICollectionView
layout for having different size of cells and I am not able to have a section in this.
Is it good idea to use multiple UICollectionView
s in the same UIViewController
? Any suggestion please?
it's simple
for every UICollectionView Delegates
- (NSUInteger)maximumNumberOfColumnsForCollectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout
- (CGFloat)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout*)collectionViewLayout
heightForItemAtIndexPath:(NSIndexPath*)indexPath
- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
cellForItemAtIndexPath:(NSIndexPath*)indexPath
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section`
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionView`
write condition inside:
if (collectionView == myCollectionView1)
{
// do this
}
else if (collectionView == myCollectionView2)
{
// do this
}
lets say for example in
- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section
{
if (collectionView == myCollectionView1)
{
return 12;
}
else if (collectionView == myCollectionView2)
{
return 7;
}
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With