gpt4 book ai didi

ios - 圆形图上的圆角末端?苹果?

转载 作者:行者123 更新时间:2023-11-29 02:00:27 27 4
gpt4 key购买 nike

我正在尝试在圆形图上重现圆形末端,但我自己无法解决。

我试过谷歌但找不到准确的术语来重新创建它。

任何人都可以引导我朝着正确的方向前进或告诉我我在寻找什么吗?

我想要一个看起来像这样的圆形图

https://www.punchkickinteractive.com/content/uploads/2014/10/apple-watch-activity-app.jpeg

如果有一个我可以设计样式的辅助库那就更好了

干杯!

最佳答案

不知道你有什么困难?如果只是绘图,那么有一种方法:

@interface ArcView ()

@property (nonatomic) double arcAngel;

@end

@implementation ArcView

- (void)drawRect:(CGRect)rect {
[super drawRect:rect];

CGPoint center = CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2);
double lineWidth = 10;
double radius = center.x - lineWidth / 2;

UIBezierPath *backCircle = [UIBezierPath bezierPathWithArcCenter:center
radius:radius
startAngle:0
endAngle:2 * M_PI
clockwise:YES];
backCircle.lineCapStyle = kCGLineCapRound;
backCircle.lineWidth = lineWidth;
[[UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:0.3f] setStroke];
[backCircle stroke];

UIBezierPath *highlightCircle = [UIBezierPath bezierPathWithArcCenter:center
radius:radius
startAngle:-M_PI_2
endAngle:self.arcAngel
clockwise:YES];
highlightCircle.lineCapStyle = kCGLineCapRound;
highlightCircle.lineWidth = lineWidth;
[[UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:1.0f] setStroke];
[highlightCircle stroke];
}

- (void)updateCircle {
self.arcAngel += M_PI_2;
[self setNeedsDisplay];
}

@end

UPD:lineCapStyle 属性设置为 kCGLineCapRound

有结果:

enter image description here

关于ios - 圆形图上的圆角末端?苹果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30441291/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com