i need first two cell small second two large again two small two large. i had tried with below code.but its not giving me proper output.else any third party library that is easy to implement for this.eagerly waiting for answer of this question.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
if (collectionView == _CollectionSale) {
if (small && j != 2){
j++;
if(j==2){
small = false;
k = 0;
}
HomeSaleCC *objHomeSaleCC=[collectionView dequeueReusableCellWithReuseIdentifier:@"HomeSaleCC" forIndexPath:indexPath];
return objHomeSaleCC;
}else if(!small && k !=2){
k++;
if(k==2){
small = true;
j = 0;
}
HomeSaleCC2 *objHomeSaleCC2=[collectionView dequeueReusableCellWithReuseIdentifier:@"HomeSaleCC2" forIndexPath:indexPath];
return objHomeSaleCC2;
}
HomeSaleCC *objHomeSaleCC=[collectionView dequeueReusableCellWithReuseIdentifier:@"HomeSaleCC" forIndexPath:indexPath];
return objHomeSaleCC;
}
else{
HomeTabCC *objHomeTabCC=[collectionView dequeueReusableCellWithReuseIdentifier:@"HomeTabCC" forIndexPath:indexPath];
[objHomeTabCC.btnSale setTitle:[arrTitle objectAtIndex:indexPath.row] forState:UIControlStateNormal];
[objHomeTabCC.btnSale setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected];
if (indexPath.row == i) {
objHomeTabCC.viewLine.hidden =NO;
objHomeTabCC.btnSale.selected =YES;
}
else{
objHomeTabCC.viewLine.hidden =YES;
objHomeTabCC.btnSale.selected =NO;
}
return objHomeTabCC;
}
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if (collectionView == _CollectionSale) {
if (small && j != 2){
j++;
if(j==2){
small = false;
k = 0;
}
return CGSizeMake(153, 186);
}
else if(!small && k !=2){
k++;
if(k==2){
small = true;
j = 0;
}
return CGSizeMake(260, 186);
}else{
return CGSizeMake(260, 186);
}
}
else{
return CGSizeMake(260, 186);
}
}