円の内側に別の円を埋めることで、進行状況を表示しようとしています。誰かがこれを達成するのを手伝ってくれますか? 私はこれについて間違った方法で行っているかもしれません。これが私のコードです:
- (void)drawRect:(CGRect)rect
{
rect = CGRectMake(0, 400, 500, 500);
[[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 500, 500) cornerRadius:50.0] addClip];
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, 2.0);
CGContextSetRGBFillColor(contextRef, 111/255.0f, 116/255.0f, 128/255.0f, 1.0);
CGRect circlePoint = (CGRectMake(0, 0, rect.size.width, rect.size.height));
CGContextFillEllipseInRect(contextRef, circlePoint);
CGContextBeginPath(contextRef);
float c = 20; //Number that should cause the green progress to increase and decrease
CGContextAddArc(contextRef, 250, 250, 250, 0, M_PI, 0);
CGContextClosePath(contextRef); // could be omitted
UIColor *color = [UIColor greenColor];
CGContextSetFillColorWithColor(contextRef, color.CGColor);
CGContextFillPath(contextRef);
}
そして、これが現在の様子のスクリーンショットです。私は基本的に、float c;
変数を使用して内部のグリーンの進行を制御できるようにしたいと考えています。
で遊んでみましたCGContextAddArc
が、「c」の値を小さくしても「c」が大きくなるにつれて円のサイズが大きくなりません