我想爲我的UITableViewCell
添加虛線底部邊框。爲UITableViewCell繪製虛線邊框底部
目前,我使用下面的代碼,
CAShapeLayer *border = [CAShapeLayer layer];
border.strokeColor = [UIColor colorWithRed:67/255.0f green:37/255.0f blue:83/255.0f alpha:1].CGColor;
border.fillColor = nil;
border.lineDashPattern = @[@1, @1];
border.path = [UIBezierPath bezierPathWithRect:cell.bounds].CGPath;
border.frame = CGRectMake(cell.bounds.origin.x, cell.bounds.origin.y + cell.bounds.size.height, cell.bounds.size.width, 1);
[cell.layer addSublayer:border];
有了這個代碼,我有一個虛線邊框底部爲我的手機,但虛線邊框的高度是兩個時間太大。
但我不是很好操縱CAShapeLayer
,我沒有找到任何幫助我的東西。
謝謝!
你把這段代碼放在哪裏? – Alper