ios - How to draw an open ended triangle with a specific angle in an UIView? -


I have been stumped here and need some help with it. For testing purposes I have a UIView which I I draw through drawRect (code below). I am able to draw a circle with a specific angle, but it is full and closed. I need to be open and stroke I am currently using UIBezierPath but is there a better way to do this? I can attract the open android triangle as I want in UIBezierPath but I can not specify the angle I want (code below as well). Any assistance with this will be greatly appreciated. Thanks

The picture below will look like how I like it when I draw it with a specific angle

 Enter image details here

  #import" AngleView.h "#define DEGREES_TO_RADIANS (degrees) ((M_PI * degrees) / 180) @ Implementation AngleView - (zero) drawRect: (CGRect) Rect {UIBezierPath * aPath = [UIBezierPath bezierPathWithArcCenter: CGPointZero Radius: 50 startAngle: 0 endAngle: DEGREES_TO_RADIANS (45) clockwise: NO]; [Fill epath]; .} @end   

And here I can draw it without a specific angle.

  UIBezierPath * bezierPath = [UIBezierPath bezierPath]; [Bezierpath left to point: CG pointmake (86.5, 33.5)]; [Bezierpath Adeline Towpoint: CG PointMake (60.5, 62.5)]; [Bezierpath Adeline Totpoint: CG PointMake (87.5, 62.5)]; [[UIColor blackColor] Setstroke]; BezierPath.lineWidth = 1; [Beijerpath stroke];    

Instead of trying to draw a single line, you get two different from the same point You can give an angle to one of them. - (Zero) Direct: (CGRTact) Rect {CGContextRef context = UIGraphicsGetCurrentContext (); CGContextSaveGState (reference); CGContextTranslateCTM (Reference, 0, 119.5); // Here you can set CGContextRotateCTM to the starting point of the line (reference, -45 * M_PI / 180); // Change Angle here -45 UIBezierPath * bezierPath = UIBezierPath.bezierPath; [Bezierpath Hilltouin: CG PointMake (0, 0)]; [BezierPath addCurveToPoint: CGPointMake (39, 0) controlPoint1: CGPointMake (39, 0) controlPoint2: CGPointMake (39, 0)]; [UIColor.blackColor Setstroke]; BezierPath.lineWidth = 1; [Beijerpath stroke]; CGContextRestoreGState (reference); // II UIBezierPath with 0 angle reference = UIGraphicsGetCurrentContext (); UIBezierPath * bezier2Path = UIBezierPath.bezierPath; [Bizzar 2 path hilltouin: CGPointMake (0, 119.5)]; [Bezier2Path addCurveToPoint: CGPointMake (38.5, 119.5) controlPoint1: CGPointMake (38.5, 119.5) controlPoint2: CGPointMake (38.5, 119.5)]; [UIColor.blackColor Setstroke]; Bezier 2 path.lineview = 1; [Bijier 2 Path Stroke]; CGContextRestoreGState (reference); }

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -