Я хочу сделать счетчик, как на этой картинке.
У меня есть 2-метровые изображения - изображение измерителя цвета и изображение измерителя серого.
И я хочу сделать материал, как показано на изображении выше, используя их.
Но я понятия не имею.
У меня есть пример кода для создания круглого метра и заполнения его цветом. Вот этот код:
CAShapeLayer *circle=[CAShapeLayer layer];
circle.path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(29, 29) radius:27 startAngle:2*M_PI*0-M_PI_2 endAngle:2*M_PI*1-M_PI_2 clockwise:YES].CGPath;
circle.fillColor=[UIColor clearColor].CGColor;
circle.strokeColor=[UIColor greenColor].CGColor;
circle.lineWidth=4;
CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"strokeEnd"];
animation.duration=10;
animation.removedOnCompletion=NO;
animation.fromValue=@(0);
animation.toValue=@(1);
animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
[circle addAnimation:animation forKey:@"drawCircleAnimation"];
[imageCircle.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];
[imageCircle.layer addSublayer:circle];
Если у вас есть идея, пожалуйста, поделитесь ею со мной. (это нормально, что ваша идея использует этот шнур или нет)
Спасибо.