【发布时间】:2017-09-26 16:50:38
【问题描述】:
我只能在圆弧中用渐变色填充圆弧你能提供解决方案enter image description here
CGContextRef ctx = UIGraphicsGetCurrentContext();
UIBezierPath *arc = [UIBezierPath bezierPathWithArcCenter:barCenter radius:barRadius startAngle:fmodf(MIN_ANGLE+M_PI, 2*M_PI) endAngle:fmodf(MAX_ANGLE+M_PI, 2*M_PI) clockwise:YES];
CGContextSetLineCap(ctx, kCGLineCapRound);
CGContextSetLineWidth(ctx, kArcThickness);
CGContextSetGrayStrokeColor(ctx, 0.6, 1.0);
CGContextAddPath(ctx, arc.CGPath);
CGContextStrokePath(ctx);
// knob to move the slider
CGContextSetLineWidth(ctx, 2.0);
CGContextSetFillColorWithColor(ctx, [UIColor whiteColor].CGColor);
CGContextAddArc(ctx, knobCenter.x, knobCenter.y, knobRadius, 0, 2*M_PI, 1);
CGContextDrawPath(ctx, kCGPathFill);
【问题讨论】:
-
你需要什么输出..?
-
我需要一条线宽为 10 的弧线,并且弧线颜色需要是渐变色
标签: ios objective-c iphone