【发布时间】:2013-02-26 14:06:15
【问题描述】:
所以我遇到了在我的UITableViewCell 中设置 custum selectedBackgroundView 的问题。
我的单元格有一个contentView,它基本上是一个黑色背景的UIView(帧= 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 的黑色部分?
我已经尝试使用从x = 80 开始的帧来初始化我的bgColorView,但这并没有改变任何东西。
我还尝试将imageView 的backgroundColor 显式设置为黑色,结果相同。
什么可能导致这种行为?
【问题讨论】:
标签: iphone ios objective-c uitableview uiimageview