아래 코드를 사용하여 다각형을 그립니다. 내가 할 이미지는 다음과 같습니다 :iOS의 코어 그래픽을 사용하여 그린 선의 접합부에서 점이 나타나는 이유는 무엇입니까?
내가 사각형을 그리기 위해 사용하고 코드는 다음과 같습니다 :
는CGContextRef currentContext = UIGraphicsGetCurrentContext();
[topLeftBoxBorderColor set];
CGContextSetLineWidth(currentContext, 1.0f);
CGContextSetLineJoin(currentContext,kCGLineJoinMiter);
CGContextMoveToPoint(currentContext, originXOfSubviews, originYOfSubviews);
CGContextAddLineToPoint(currentContext, originXOfSubviews+widthOfBox, originYOfSubviews);
CGContextAddLineToPoint(currentContext, originXOfSubviews+widthOfBox, originYOfSubviews+heightOfBox);
CGContextAddLineToPoint(currentContext, originXOfSubviews, originYOfSubviews+heightOfBox);
CGContextAddLineToPoint(currentContext, originXOfSubviews, originYOfSubviews);
CGContextStrokePath(currentContext);
모든 코너에 두 줄의 교차점에 흰색 점이있다. 이 점이 없게하는 방법이 있습니까?
UPDATE 1 :
나는 아래의 해결책을 알고 라인을 바탕으로 라인의 시작, 포인트가 변경 내가 기대하는 것을 얻을 수있다 폭. 그러나 다른 해결책이 있습니까?
업데이트 2 : 나는 다각형
나는보다 1 이하로 선폭을 설정 지금 같은 문제가 발생 그릴 아래의 코드를 사용하고
. 2 이상으로 설정하면 문제가 발생하지 않습니다.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, topLeftBoxBorderColor.CGColor);
CGRect rectangle = CGRectMake(originXOfSubviews,originYOfSubviews,widthOfBox,heightOfBox);
CGContextAddRect(context, rectangle);
CGContextStrokePath(context);
투명도와 색상을 사용합니까의 사각형 그릴 수 있습니까? – AlexWien
나는 그것을 사용하지 않고있다. – Krishnan
나는 더 이상 하얀 점이 보이지 않는다. 나는 접합부가 겹치는 것을 보았다. 어떤 점에서 transparancy 효과가있을 때 그 효과를 일으킨다. 해당 POS에 nö 추가 Point가 있습니다. 잘못된 색상의 Point가 있습니다. – AlexWien