UIButton *WalkingImageView = [[UIButton alloc]initWithFrame:CGRectMake(30, 0,45, 45)];
WalkingImageView.image=imageNamed(@"walkHomeIcon");
WalkingImageView.centerY=self.height/2.0;
[self addSubview:WalkingImageView];
CAShapeLayer * line = [CAShapeLayer layer];
CGMutablePathRef path = CGPathCreateMutable();
line.fillColor = [UIColor clearColor].CGColor;
line.strokeColor = rgb(190, 190, 190).CGColor;
line.lineWidth = 10.0f;//长度
float addwidth=27+15;//圆环比走路图标大多少
CGPathAddEllipseInRect(path, nil, CGRectMake(-addwidth/2.0, -addwidth/2.0, WalkingImageView.width+addwidth, WalkingImageView.height+addwidth));
line.path = path;
line.lineDashPhase = 1.0;
line.lineDashPattern = @[@1,@5];//@1:宽度 @5:间隔
[WalkingImageView.layer addSublayer:line];
IMG_0920.jpg
网友评论