Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UICollectionViewCell大小动画_Ios_Objective C_Uicollectionview - Fatal编程技术网

Ios UICollectionViewCell大小动画

Ios UICollectionViewCell大小动画,ios,objective-c,uicollectionview,Ios,Objective C,Uicollectionview,我使用的UICollectionView中有两列。我需要在点击单元格时调整其大小并将其展开。我正在使用下面的代码,除了整行扩展而不是单个单元格外,这些代码似乎正在工作。。。我确信一定有办法避免使用UICollectionView,我不想因为这个小问题而使用两个单独的表视图 PFB我用来调整单元格大小的代码 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)coll

我使用的UICollectionView中有两列。我需要在点击单元格时调整其大小并将其展开。我正在使用下面的代码,除了整行扩展而不是单个单元格外,这些代码似乎正在工作。。。我确信一定有办法避免使用UICollectionView,我不想因为这个小问题而使用两个单独的表视图

PFB我用来调整单元格大小的代码

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{

    CGSize itemSize;

    if([self.selectedOrder isEqual:indexPath]) {

        NSLog(@"coming");
     itemSize = (CGSize ){.width = 330, .height = 150};

    }
    else {

    itemSize = (CGSize ){.width = 330, .height = 75};

    }

    return itemSize;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {

    if([self.selectedOrder isEqual:indexPath]) {

        self.selectedOrder = [NSIndexPath indexPathForItem:-1 inSection:-1];
    }
    else {

        self.selectedOrder = indexPath;

    }
    [collectionView performBatchUpdates:^{
        // append your data model to return a larger size for
        // cell at this index path
       // [collectionView invalidateIntrinsicContentSize];
        [collectionView.collectionViewLayout invalidateLayout];
        [collectionView reloadItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]];
    } completion:^(BOOL finished) {

    }];

}

我没有使用customFlowLayout。。如果需要,请指导我需要在其中实现哪些方法。。不幸的是,我不能添加屏幕截图,因为我是这个网站的新手。。