Draw dotted (not dashed!) line, with IBDesignable in 2017

前端 未结 10 1687
死守一世寂寞
死守一世寂寞 2020-11-28 03:25

It\'s easy to draw a dashed line with UIKit. So:

CGFloat dashes[] = {4, 2};
[path setLineDash:dashes count:2 phase:0];
[path stroke];
         


        
10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 04:20

    Working fine with the below code,

    layer.path = linePath.cgPath
    layer.lineWidth = 3
    layer.lineDashPattern = [1,layer.lineWidth*2] as [NSNumber]
    layer.lineCap = "round"
    

提交回复
热议问题