지도 앱을 사용하여지도 주석을 그려야합니다. MapKit의 MKAnnotationView와 매우 유사하지만 mapkit은 없습니다.Core Graphics - iPhone으로 경로를 그리는 데 문제가 있습니다.
내가 알아낼 수없는 뷰 개요의 경로 순서에 문제가 있습니다. 결과
이미지 :
이http://img504.imageshack.us/img504/5458/screenshot20091010at703.png
코드 :
CGFloat minx = CGRectGetMinX(currentBounds);
CGFloat midx = CGRectGetMidX(currentBounds);
CGFloat maxx = CGRectGetMaxX(currentBounds);
CGFloat miny = CGRectGetMinY(currentBounds)+10.0f;
CGFloat midy = CGRectGetMidY(currentBounds)+10.0f;
CGFloat maxy = CGRectGetMaxY(currentBounds)+10.0f;
CGContextBeginPath(currentContext);
CGContextMoveToPoint(currentContext, minx, miny+radius); //before top left arc
CGContextAddArcToPoint(currentContext, minx, miny, midx, miny, radius); //top left
CGPoint points1[] = {
CGPointMake(midx-10.0f, miny),
CGPointMake(midx, 0.0f), //tip of arrow
CGPointMake(midx+10.0f, miny),
};
CGContextAddLines(currentContext, points1, 3);
CGContextAddArcToPoint(currentContext, maxx, miny, maxx, midy, radius); //top right
CGContextAddArcToPoint(currentContext, maxx, maxy, midx, maxy, radius); //bottom right
CGContextAddArcToPoint(currentContext, minx, maxy, minx, midy, radius); //bottom left
CGContextClosePath(currentContext);
CGContextClosePath(currentContext);
CGContextDrawPath(currentContext, kCGPathFillStroke);
//CGContextDrawPath(currentContext, kCGPathEOFillStroke);
CGContextAddToLines가 암시 적으로 'moveto'를 수행하여 명시 적으로 취소 된 것처럼 작동하지 않는 것은 아닙니다. 내 답변에 대한 나의 최신 코멘트를 참조하십시오. –