0
我有一種情況,用戶將在屏幕上點擊並輸入度數,並且應該從給定度數中的抽頭點繪製一條線。在ios中的視圖上畫出一條直線給定點和度數?
我正在使用下面的路徑代碼來繪製線,但我不能以正確的程度繪製線。
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path,NULL,touchx,touchy);
CGPathAddLineToPoint(path, NULL,endX, endY);
lineLayer = [CAShapeLayer layer];
[lineLayer setPath:path];
[lineLayer setFillColor:[[UIColor lightTextColor] CGColor]];
[lineLayer setStrokeColor:[[UIColor blackColor] CGColor]];
[lineLayer setAnchorPoint:CGPointMake(0.0f, 0.0f)];
[lineLayer setPosition:CGPointMake(0.0f, 0.0f)];
[drawingview.layer addSublayer:lineLayer];
CGPathRelease(path);