2
점선 (중국 점)과 같은 특수한 형태의 선을 그릴 수 있습니까? 아래 코드로 그립니다.점선 (중국 점)과 같은 특수한 형태의 선 그리기
UIGraphicsBeginImageContext(self.view.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, 320, 480)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.867, 0.867, 0.867, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), startPoint.x, startPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), endPoint.x, endPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
CGContextFlush(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
감사가 가능 내 편집을 참조하십시오 –
원과 같은 다른 모양과 라인을 그릴을 겪었 :
이 예는 원 (: 20 점, 거리 : 40 점 직경)와 선을 그립니다 대답 – Felix