ars*_*ena 4 objective-c ios swift
我用这个例子在上画了虚线uiview:
UIBezierPath *path = [UIBezierPath bezierPath];
//draw a line
[path moveToPoint:yourStartPoint]; //add yourStartPoint here
[path addLineToPoint:yourEndPoint];// add yourEndPoint here
[path stroke];
float dashPattern[] = {1,1,1,1}; //make your pattern here
[path setLineDash:dashPattern count:4 phase:0];
UIColor *fill = [UIColor blueColor];
shapelayer.strokeStart = 0.0;
shapelayer.strokeColor = fill.CGColor;
shapelayer.lineWidth = 7.0;
shapelayer.lineJoin = kCALineJoinMiter;
shapelayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:10],[NSNumber numberWithInt:10], nil];
shapelayer.lineDashPhase = 3.0f;
shapelayer.path = path.CGPath;
Run Code Online (Sandbox Code Playgroud)
它有效,但问题是即使我将uiview高度设置为 1,我得到的线条也很粗。

有没有可能让它更薄?
您可以在代码的这一部分更改线条的粗细:
shapelayer.lineWidth = 7.0;
Run Code Online (Sandbox Code Playgroud)
将 更改为7.0您希望线条具有的任何粗细。
| 归档时间: |
|
| 查看次数: |
428 次 |
| 最近记录: |