Où en évidence UICollectionViewCell: délégué ou de la cellule?

Selon la Vue De Collection Guide De Programmation on doit gérer l'état visuel de la cellule en surbrillance dans la UICollectionViewDelegate. Comme ceci:

- (void)collectionView:(PSUICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    MYCollectionViewCell *cell = (MYCollectionViewCell*)[collectionView cellForItemAtIndexPath:indexPath];
    [cell highlight];
}

- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    MYCollectionViewCell *cell = (MYCollectionViewCell*)[collectionView cellForItemAtIndexPath:indexPath];
    [cell unhighlight];
}

Ce que je n'aime pas à propos de cette approche est qu'il ajoute une logique à l'délégué qui est très spécifique à la cellule. En fait, UICollectionViewCell gère son surbrillance de manière indépendante, par l'intermédiaire du highlighted propriété.

Ne serait pas primordial setHighlighted: être une solution plus propre, alors?

- (void)setHighlighted:(BOOL)highlighted
{
    [super setHighlighted:highlighted];
    if (highlighted) {
        [self highlight];
    } else {
        [self unhighlight];
    }
}

Qu'il ya des inconvénients à cette approche au lieu de la déléguer approche?

InformationsquelleAutor hpique | 2013-03-18