2
votes

This code is creating a UIBezierPath, which is ROUND in shape as given image.

enter image description here

CGPoint arcCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
CGFloat radius = CGRectGetWidth(self.bounds) / 2.0f;
float angle = value * 360.0;
float x = radius * sin(angle*M_PI/180.0);
float y = radius * cos(angle*M_PI/180.0);

CGPoint capArcCenter = CGPointMake(arcCenter.x + x, arcCenter.y - y);
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:capArcCenter
                                                    radius:self.gaugeWidth*_lineLayer.shadowRadius / 2.0f
                                                startAngle:(3.0f * M_PI_2)
                                                  endAngle:(3.0f * M_PI_2) + (2.0f * M_PI)
                                                 clockwise:YES];
return path;

I want this as Line crossing vertically, as below.... enter image description here

How to create a UIBezierPath, crossing like SECONDS line in clock.

Thanks.

1

1 Answers

0
votes

Assuming you are trying to make a separate UIBezierPath to do this I would suggest simply create the path you want to represent that line say:

 myPath = [UIBezierPath bezierPath];
 [myPath moveToPoint:startpoint];
 [myPath addLineToPoint:endpoint];

And then apply a CGAffineTransform to it to rotate it around the gauge face.

Hopefully that helps