원을 그리며 3 번 색상을 변경하는 원호가 있습니다. 그래서 나를 시작하기 위해 예제를 사용했습니다. Change CALayer color while animating움직이는 동안 CALayer의 색상을 변경하는 방법
이 예제는 작동하지만 색상은 녹색, 녹색, 파란색입니다. 나는 그 (것)들을 녹색, 주황색, 그 후에 빨간색으로하고 싶다. 나는 코드에서 그 색상을 변경하는 방법을 알아 내려고 노력하고있어, 그것은 나에게 매우 혼란 :
이strokePart.strokeColor = [[UIColor colorWithHue: i * portion saturation:1 brightness:1 alpha:1] CGColor];
내 목표는 : 그래서
for (NSUInteger i = 0; i < 3; i++)
{
CAShapeLayer* strokePart = [[CAShapeLayer alloc] init];
strokePart.fillColor = [[UIColor clearColor] CGColor];
strokePart.frame = tutorialCircle.bounds;
strokePart.path = tutorialCircle.path;
strokePart.lineCap = tutorialCircle.lineCap;
strokePart.lineWidth = tutorialCircle.lineWidth;
// These could come from an array or whatever, this is just easy...
strokePart.strokeColor = [[UIColor colorWithHue: i * portion saturation:1 brightness:1 alpha:1] CGColor];
내가 믿는이 라인은 색상 변화를하고있다 레드 그린과 블루 대신에 그린 오렌지 레드로 그 색상을 조작 할 수 있습니다.
감사
편집 :
이 부분의 값은 다음과 같습니다
const double portion = 1.0/((double)3);
'부분'값은 무엇입니까? – Kie
단지 1/3이므로 const double 부분 = 1.0/((double) 3); –
오히려 1/3 또는 0.333333과 비슷합니다. 맞습니까? – Kie