我有一个UICollectionView。当用户点击一个单元格时,我必须扩展单元格的大小。我是这样做的,
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView performBatchUpdates:^{
isExpandedMode = true;
expandedPosition = indexPath.row;
[self.collectionView reloadItemsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil]];
} completion:^(BOOL finished) {
}];
}
现在我在这里更新单元格大小,
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if(isExpandedMode && expandedPosition == indexPath.row){
CGFloat screenWidth = 568.0;
CGFloat screenHeight = 293.0;
return CGSizeMake(screenWidth, screenHeight);
}
else{
CGFloat screenWidth = 172.0;
CGFloat screenHeight = 293.0;
return CGSizeMake(screenWidth, screenHeight);
}
}
现在我想将动画应用于单元格的扩展,在哪里编写这段代码?