Ios 在UIView中用线连接的自定义圆

Ios 在UIView中用线连接的自定义圆,ios,iphone,objective-c,ios7,Ios,Iphone,Objective C,Ios7,我需要画一个进程指标(不是一个进度指标),根据约束动态改变笔划和填充颜色。我发现画出所需的形状真的很困难。任何指导都很好 我怎么能画这个?UI应该类似于进度视图,但在行之间有圆圈。谢谢您应该能够使用CAShapeLayers和QuartzCore绘制这种东西 将CoreGraphics.framework添加到库中 在你们班上名列前茅 #import <QuartzCore/QuartzCore.h> 您还可以为这些对象上的大多数属性设置动画(如不透明度),使进度条具有随时间缓慢填

我需要画一个进程指标(不是一个进度指标),根据约束动态改变笔划和填充颜色。我发现画出所需的形状真的很困难。任何指导都很好


我怎么能画这个?UI应该类似于进度视图,但在行之间有圆圈。谢谢

您应该能够使用CAShapeLayers和QuartzCore绘制这种东西

将CoreGraphics.framework添加到库中

在你们班上名列前茅

#import <QuartzCore/QuartzCore.h>

您还可以为这些对象上的大多数属性设置动画(如不透明度),使进度条具有随时间缓慢填充的效果。

这是一个模糊的问题。我不知道你想完成什么或你目前尝试了什么。你能提供一组图片来说明你在寻找什么吗?我为不能详细表达我的歉意,其基本思想是根据用户的特定偏好,动态地画出由线条连接的圆圈……就像我的朋友是一种生活品味!正如你所描述的那样,我试图上传图片,但由于我是这个社区的新手,我需要有一个声誉来添加图片。我会试试这个
// this will be a parent layer container
CALayer *progressIndicator = [[CALayer alloc] init];

// the first bubble
CAShapeLayer *bubble1 = [[CAShapeLayer alloc] init];
bubble1.fillColor = [UIColor lightGrayColor];
bubble1.strokeColor = [UIColor darkGrayColor];
bubble1.strokeWidth = 1;
bubble1.path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,0,50,50)].CGPath;
[progressIndicator addSublayer:bubble1];

// the first connecting line
CAShapeLayer *line1 = [[CAShapeLayer alloc] init];
line1.strokeColor = [UIColor darkGrayColor];
line1.strokeWidth = 2;

UIBezierPath *linePath = [UIBezierPath bezierPath];
[linePath moveToPoint:CGPointMake(50, 25)];
[linePath addLineToPoint:CGPointMake(75, 25)];

line1.path = linePath.CGPath;
[progressIndicator addSublayer:line1];

// ... And so on for the next 2 bubbles and 1 line. ...//

// Add it to your view.
[self.view.layer addSublayer:progressIndicator];