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