3
我以前this example借鑑uiview
虛線:更改虛線厚度在IOS
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;
它的工作原理,但問題是,即使我把我的uiview
身高1,我得到的線頗濃。
是否有可能使它更薄?
WTF:/爲什麼地獄名爲lineWIDTH的屬性改變了它的高度? :( 無論如何,非常感謝:| – arsena
,因爲'線'有寬度不高度,英語;;) –
'lineThickness'會有道理 – RJR