2011-10-28 4 views
2

저는 CALayer에 경로를 칠하여 iOS에서 선을 그립니다. 라인의 왼쪽 끝이 오른쪽 끝보다 얇아 지도록 줄 폭 (스트로크 폭)을 늘려이 줄을 어떻게 칠할 수 있습니까? (strokeEnd 속성을 사용할 예정이므로 모양이나 닫힌 패스가 아니라 선이어야합니다.)iPhone에서 lineWidth가 증가하는 선을 그립니다.

도움을 주셔서 감사합니다.

답변

0

그리기 기능을 사용하십시오. 처음에는 익숙해지기가 꽤 짜증나지만 일은 잘합니다. 더 이상 도움이 필요하면 바로 의견을 남기십시오.

-(void)draw{ 
    float lineHeight = 5;//change this as you see fit, like set it equal to an incrementing/decrementing variable of your choice... 
    glEnable(GL_LINE_SMOOTH); 
    glLineWidth(lineHeight); // change this as you see fit 
    glColor4ub(255,255,255,255); // change these as you see fit :) 
    ccDrawLine(ccp(10,310), ccp(30,310)); // these numbers are probably off, you'll have to mess with these to get it in the right position :) 
     [super draw]; 
     } 
+0

저는 이것이 cocos2D와 관련이 있다고 생각합니다. 나는 CCLayer가 아닌 QuartzCore CALayer/CAShapeLayer를 사용하고 있습니다. – hsdev

+0

아, 미안, 이걸로 cocos2d가 필요할지도 몰라. 미안해, xcode의 일부라고 생각해. – Gabe

+0

cocos2D를 사용하는 것 외에 다른 가능한 해결책이 있습니까? – hsdev

관련 문제