Reputation: 3358
Am using UICollectionView and changing the size of the item in the delegate method of collection view like this
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
lastIndex = 0;
layoutDiff = 4;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == (lastIndex + layoutDiff) - 1){
layoutDiff = (layoutDiff == 4)?5:4;
lastIndex = indexPath.row + 1;
return CGSizeMake(213.2, 213.2);
}
return CGSizeMake(106.6, 106.6);
}
and here is my current screen.
and all the below cells to be follow this behaviour, means the pattern i want is like one collection view item to big depending on my logic where i want to make it big but i don't want this space. I think if the space will not b there then all things will be right. Can anyone help with this?
Upvotes: 0
Views: 186
Reputation: 171
FlowLayout can't help with this.
You hava to implement your subclass of UICollectionLayout.
Here are some articles that take about custom Collection View Layout.
Custom Collection View Layouts.
https://www.objc.io/issues/3-views/collection-view-layouts/
Knowing When to Subclass the Flow Layout https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/UsingtheFlowLayout/UsingtheFlowLayout.html#//apple_ref/doc/uid/TP40012334-CH3-SW4
Upvotes: 1