Я пытаюсь анимировать ячейку представления коллекции, пока это мой код
- (void)collectionView:(UICollectionView *)collectionView didUpdateFocusInContext:(UICollectionViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator{
UICollectionViewCell *nextFocusedCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"VideoCell" forIndexPath:context.nextFocusedIndexPath];
UICollectionViewCell *previousFocusedCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"VideoCell" forIndexPath:context.previouslyFocusedIndexPath];
if (context.nextFocusedView) {
[coordinator addCoordinatedAnimations:^{
[nextFocusedCell setFrame: CGRectMake(3, 14, 300, 300)];
} completion:^{
// completion
}];
} else if (context.previouslyFocusedView) {
[coordinator addCoordinatedAnimations:^{
[previousFocusedCell setFrame: CGRectMake(3, 14, 100, 100)];
} completion:^{
// completion
}];
}
Но мой код не работает. Я прочитал документацию, и в ней говорится, что нужно реализовать что-то вроде if (self == contextFocusedView)...... но в нем есть предупреждение о том, что несовместимый указатель View Controller с UIView. Может ли кто-нибудь сказать мне, что не так с моим кодом и как это исправить? Спасибо!!
else if
, а простоif
. - person Banana   schedule 26.10.2015