所以我有一个UICollectionView,我已经做了这样的事情,当焦点改变到新的单元格时,单元格中的图像展开。由于某种原因,尽管每次UICollectionView加载第一个单元比其余的单元大(见下面的截图)。我怎样才能阻止它做到这一点?UICollectionView第一个单元格比tvOS上的其他单元格加载更大
我对焦点的改变过形象代码:
- (void)collectionView:(UICollectionView *)collectionView didUpdateFocusInContext:(UICollectionViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
NSIndexPath *previousIndexPath = context.previouslyFocusedIndexPath;
NSIndexPath *indexPath = context.nextFocusedIndexPath;
TrophyCollectionViewCell *previousCell = (TrophyCollectionViewCell *)[collectionView cellForItemAtIndexPath:previousIndexPath];
TrophyCollectionViewCell *cell = (TrophyCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
[UIView animateWithDuration:0.3 animations:^{
if (previousCell.trophyImageView != nil) {
previousCell.trophyImageView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
}
if (cell.trophyImageView != nil) {
cell.trophyImageView.transform = CGAffineTransformMakeScale(1.2f, 1.2f);
}
if (previousCell.resetImageView != nil) {
previousCell.resetImageView.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
}
if (cell.resetImageView != nil) {
cell.resetImageView.transform = CGAffineTransformMakeScale(1.2f, 1.2f);
}
}];
}
除了这个我已经影响了细胞的大小没有其他代码。