UITableViewCell personnalisé selectedBackgroundView problème

Donc, je suis confronté à un problème avec la fixation d'un custum selectedBackgroundView à l'intérieur de mon UITableViewCell.

Ma cellule a un contentView que, fondamentalement, est un UIView (frame = 0,0,80,70) avec un fond noir et un UIImageView comme une sous-vue.

L'imageView est contentMode = UIViewContentModeScaleAspectFit;

Cela ressemble à quelque chose comme ceci:

UITableViewCell personnalisé selectedBackgroundView problème

Maintenant je l'ai mis la selectedBackgroundView comme ceci:

    //set the custom selected color
    UIView *bgColorView                 = [[UIView alloc] init];
    bgColorView.backgroundColor         = MY_TINT_COLOR;
    CGColorRef darkColor                = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha: 0.25].CGColor;
    CGColorRef lightColor               = [self.view.backgroundColor colorWithAlphaComponent:0.0].CGColor;
    //setting some gradients here
    //should not be relevant for the question
    [cell setSelectedBackgroundView:bgColorView];

Cela se traduit par quelque chose comme ceci:

UITableViewCell personnalisé selectedBackgroundView problème

Ma question est maintenant de savoir pourquoi la selectedBackgroundView cache la partie noire de la contentView?

J'ai déjà essayé de l'initialisation de mon bgColorView avec un cadre de départ à x = 80, mais cela ne change rien.

Aussi j'ai essayé de définir explicitement la backgroundColor de la imageView noir, le même résultat.

Quelle est la cause de ce comportement?

OriginalL'auteur pmk | 2013-03-11