そのため、カスタム selectedBackgroundView を my 内に設定する際に問題に直面していUITableViewCell
ます。
私のセルには、contentView
基本的にUIView
(frame = 0,0,80,70) で、背景が黒UIImageView
でサブビューとして があります。
imageView のcontentMode = UIViewContentModeScaleAspectFit;
これは次のようになります。
ここで、selectedBackgroundView を次のように設定します。
//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];
これにより、次のような結果になります。
私の質問は、なぜ がselectedBackgroundView
の黒い部分を隠すのcontentView
かということです。
bgColorView
から始まるフレームですでに初期化を試みましx = 80
たが、何も変わりません。
backgroundColor
また、明示的にを黒に設定しようとしましたがimageView
、同じ結果です。
この動作の原因は何ですか?