사용자가 클릭하여 끌 수있는 그래프에 위젯을 추가하고 싶습니다. CPTPlotSpaceAnnonation을 사용하여이 작업을 수행했습니다. 왜냐하면 CPTlordSpaceAnnonation은 데이터로 스크롤하기를 원하기 때문입니다. CPTBorderedLayer. 기본 기능이 작동하고 이제 위젯의 모양을 개선하고 싶습니다. 지금까지는 단지 녹색 원이었습니다.CPTPlotSpaceAnnotation의 레이어 모양을 변경 하시겠습니까?
는 다음과 코드는 아래의 원을 생성하는 그림자 레이어의 RECT 클리핑하는 방법을주의하고 경계 레이어가 아닌 원, 어떻게 내가 뇌졸중 원
을 다음과 레이어가 아닌가요? 레이어의 프레임을 크게하여 클리핑을 피할 수 있다고 생각합니다. Core Plot 주석과 함께 CAShapeLayer 클래스를 사용할 수 있습니까? 이것은 위젯을 그리는 쉬운 방법 일 것입니다.
// Add a circular annotation to graph with fill and shadow
annotation = [[CPTPlotSpaceAnnotation alloc]
initWithPlotSpace:graph.defaultPlotSpace
anchorPlotPoint:anchorPoint];
// Choosing line styles and fill for the widget
NSRect frame = NSMakeRect(0, 0, 50.0, 50.0);
CPTBorderedLayer *borderedLayer = [[CPTBorderedLayer alloc] initWithFrame:frame];
// Circular shape with green fill
CGPathRef outerPath = CGPathCreateWithEllipseInRect(frame, NULL);
borderedLayer.outerBorderPath = outerPath;
CPTFill *fill = [CPTFill fillWithColor:[CPTColor greenColor]];
borderedLayer.fill = fill;
// Basic shadow
CPTMutableShadow *shadow = [CPTMutableShadow shadow];
shadow.shadowOffset = CGSizeMake(0.0, 0.0);
shadow.shadowBlurRadius = 6.0;
shadow.shadowColor = [[CPTColor blackColor] colorWithAlphaComponent:1.0];
borderedLayer.shadow = shadow;
// Add to graph
annotation.contentLayer = borderedLayer;
annotation.contentLayer.opacity = 1.0;
[graph addAnnotation:annotation];
주석이 쓰다듬어지고 여전히 정사각형 인 것처럼 보입니다. 또한 주석이 하위보기를 자체 범위로 클리핑하는 것처럼 보입니다. –