사용자가 누를 때 UICollectionViewCell 크기를 조정하려고 시도했습니다. 현재 셀의 크기는 조정되지만 다른 셀은 조정되지 않습니다. 여기UICollectionView의 크기가 올바르게 조정되지 않음
내가 사용하고있는 코드입니다 : 여기에 문제의 사진입니다. 나는 문제가 무효화 함께 느낌,하지만 나는 확실하지 않다 :
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell * cellToChangeSize = [self.collectionView cellForItemAtIndexPath:indexPath]; // Avoid retain cycles
void (^animateChangeWidth)() = ^()
{
CGRect frame = cellToChangeSize.frame;
frame.size = CGSizeMake(300, 100);
cellToChangeSize.frame = frame;
};
// Animate
[UIView transitionWithView:cellToChangeSize duration:0.1f options: UIViewAnimationOptionCurveLinear animations:animateChangeWidth completion:^(BOOL finished) {
[self.collectionView.collectionViewLayout invalidateLayout];
}];
}