0
我想为UITableViewCell选择做一个自定义颜色。我不希望整个单元格按下时突出显示,换句话说,选择背景的框架应该是(10,cell.frame.origin.y,300,cell.frame.size.height)。我试图给backgroundColorView.layer.borderWidth属性的值为10,但这会影响整个视图,而不仅仅是左右边框。这是我现在卡在的代码:设置CALayer的borderWidth属性只影响左右边界?
UIView *backgroundColorView = [[UIView alloc] init];
backgroundColorView.backgroundColor = SWITCH_COLOR_ON;
backgroundColorView.layer.masksToBounds = YES;
// backgroundColorView.layer.borderWidth = 10.0f; // this shrinks the entire view
[cell setSelectedBackgroundView:backgroundColorView];
有关如何使这项工作的任何提示?谢谢。
工作得很好,谢谢!我要提到的唯一的事情是它必须是*(0,0,10,高度)和(宽度-10,0,10,高度)。不管怎么说,多谢拉!干杯 – nemesis