Из следующих двух строк вашего кода:
shapeLayer.lineJoin = kCALineJoinRound
shapeLayer.path = UIBezierPath(roundedRect: CGRect(x: 0, y: shapeRect.height, width: shapeRect.width, height: 0), cornerRadius: 0).cgPath
kCALineJoinRound
создает верхнюю и нижнюю штриховые линии, но они перекрываются, поскольку height
из UIBezierPath
равно 0. Итак,Обновлен ваш код как:
shapeLayer.path = UIBezierPath(roundedRect: CGRect(x: 0, y: shapeRect.height, width: shapeRect.width, height: 1), cornerRadius: 0).cgPath
Он скроет нижнюю строку и вы получите желаемый результат.
Лучшее решение:
Скореечем скрыть нижнюю черту, вы можете исправить ее, указав CAShapeLayer
просто *1017*, например:
shapeLayer.lineJoin = kCALineJoinRound
shapeLayer.lineDashPhase = 3.0 // Add "lineDashPhase" property to CAShapeLayer
shapeLayer.lineDashPattern = [9,6]
shapeLayer.path = UIBezierPath(roundedRect: CGRect(x: 0, y: shapeRect.height, width: shapeRect.width, height: 0), cornerRadius: 0).cgPath
Полученная строка: