2014-09-10 4 views
0

그래서 core-plot을 사용하고 CPTAxisLabel에 대해 CPTLayer의 메서드를 재정의해야하지만 모든 레이블에 대해 메서드를 재정의해야하므로 CustomCPTAxisLabel 클래스를 만들었습니다. 문제는 renderAsVectorInContext 마녀가 CPTLayer의 메소드 인 CPTAxisLabel이 CPTLayer를 상속하고 CustomCPTAxisLabel이 CPTAxisLabel (CPTLayer-> CPTAxisLabel-> CustomCPTAxisLabel)을 상속한다는 점입니다. 질문은 CustomCPTAxisLabel의 CPTLayer에서 메서드를 재정의 할 수 있습니까? 귀하의 서브 클래스 CustomCPTAxisLabel에서상속 된 클래스에서 메서드를 재정의하는 방법

답변

0

, 당신은 renderAsVectorInContext를 대체 할 방법을 정의합니다.

같은 뭔가 - (무효) renderAsVectorInContext : (CGContextRef) 컨텍스트 {

[super renderAsVectorInContext:context]; 

// Do customisation after this. 

}

당신은 나 CPTAxisLabel에게 클래스를이 메소드를 오버라이드 (override)를 선택하지만,하지 않을 수도 있습니다 수퍼 클래스를 호출하면됩니다.

+0

나는 모두 준비가되었지만 메서드가 호출되지 않고 왜 그럴 수 없습니까? – edo

+0

_CustomCPTAxisLabel_ 클래스에서 일부 코드를 게시 할 수 있습니까? 또한 당신이 그것을 위해 객체를 할당하고있는 곳의 코드. – Gandalf

+0

가 .H에서 나는 "CPTAxisLabel.h" 인터페이스 CustomCPTAxisLabel # import를 한 : CPTAxisLabel - (무효) renderAsVectorInContext : (CGContextRef) 컨텍스트; 끝 및 .m @implementation CustomCPTAxisLabel - (void) renderAsVectorInContext : (CGContextRef) context { [super renderAsVectorInContext : context]; – edo

관련 문제