Я пытаюсь нарисовать пунктирную нижнюю границу UITableViewCells
со следующим кодом:Попытки нарисовать пунктирную границу для UITableViewCell
func addDashedBottomBorder(to cell: UITableViewCell) {
let width = CGFloat(2.0)
let dashedBorderLayer: CAShapeLayer = CAShapeLayer()
let frameSize = cell.frame.size
let shapeRect = CGRect(x: 0, y: frameSize.height, width: frameSize.width*2, height: 1)
dashedBorderLayer.bounds = shapeRect
dashedBorderLayer.position = CGPoint(x: 0, y: frameSize.height)
dashedBorderLayer.strokeColor = UIColor.lightGray.cgColor
dashedBorderLayer.lineWidth = width
dashedBorderLayer.lineDashPattern = [9, 6]
dashedBorderLayer.path = UIBezierPath(roundedRect: shapeRect, cornerRadius: 5).cgPath
cell.layer.addSublayer(dashedBorderLayer)
}
Однако я получаю странную сплошную линию позади моей пунктирной линии, как может можно увидеть здесь: http://imgur.com/6kR9PgZ
Я уже установлен tableView.separatorColor = UIColor.clear
в viewDidLoad
Любые идеи, почему я получаю эту сплошную линию за штриховой один?
Вы проверили ответ –