所以我有一個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);
}
}];
}
除了這個我已經影響了細胞的大小沒有其他代碼。