Questions tagged [uibezierpath]

The UIBezierPath class lets you define a path consisting of straight and curved line segments and render that path in your custom views.

The UIBezierPath class lets you define a path consisting of straight and curved line segments and render that path in your custom views. You use this class initially to specify just the geometry for your path. Paths can define simple shapes such as rectangles, ovals, and arcs or they can define complex polygons that incorporate a mixture of straight and curved line segments. After defining the shape, you can use additional methods of this class to render the path in the current drawing context.

Its counterpart in OS X is .

Resources:

1777 questions
15
votes
2 answers

Rounding the edges of a stroke in bezier path circle in swift

I'm trying to draw a circle using UIBezierPath(ovalInRect: CGRectMake()). Then I'll change the strokeEnd property. When this happens, either end of the circular line have sharp corners. Is there any way to round out these corners? (I would like to…
Matt Spoon
  • 2,760
  • 5
  • 25
  • 41
15
votes
3 answers

Union UIBezierPaths rather than apend path

I have an app where I take a UIBezierPath and use it as a brush by a series of appendPath: calls. After a few goes and with really complex brush shapes the memory runs out and the app grinds to a halt. What I really want to do is a full on union…
Martin
  • 1,135
  • 1
  • 8
  • 19
15
votes
6 answers

Reposition/resize UIBezierPath

I have a draggable view that has a mask layer on it. The mask layer has a UIBezierPath on it which makes an area on the view see-through/transparent(the effect that i want). My end goal is to change the position and size of the path(not the mask…
Soc
  • 153
  • 1
  • 1
  • 5
15
votes
2 answers

How to fill color inside UIBezierPath?

I draw a shape by UIBezierPath in touchesMoved. -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; secondPoint = firstPoint; firstPoint = [touch previousLocationInView:self]; …
LE SANG
  • 10,955
  • 7
  • 59
  • 78
15
votes
1 answer

Get CGPath total length

I have many UIBezierPath that I am animating with CALyerAnimation @"StrokeStart" and @"strokeEnd". I wish that the animation will have the same speed for all the paths so I thougt I might use the length of the path in : DISTANCE / TIME = SPEED Is…
shannoga
  • 19,649
  • 20
  • 104
  • 169
14
votes
2 answers

Actually duplicate / extract Apple's "continuous corners for iPhoneX"?

Historic question. Pls note, it's now this simple: https://stackoverflow.com/a/59993994/294884 The unusual bottom corners of an iPhoneX are Apple's new (2017) "continuous corners for iPhoneX". It is trivial for any experienced iOS programmer to…
Fattie
  • 27,874
  • 70
  • 431
  • 719
14
votes
1 answer

Can I union multiple transparent SCNShape objects?

I'm adding multiple transparent SCNShape objects to an ARSCNSceneView scene. These shapes are based on user input and should overlap. They are all flat shapes made with UIBezierPath on the same plane Shapes has to be transparent, so the user can…
Avishay Cohen
  • 2,418
  • 1
  • 22
  • 40
14
votes
3 answers

Create Hexagon ImageView shape in iOS

I want Above Hexagon shape for my ImageView. But After implementing below code I am getting this Image - (UIBezierPath *)roundedPolygonPathWithRect:(CGRect)square lineWidth:(CGFloat)lineWidth …
Gaurav Singla
  • 2,271
  • 26
  • 43
14
votes
3 answers

How can I mirror a UIBezierPath?

I have a UIBezierPath and I would like to get its mirror image. How can I accomplish this? // Method for generating a path UIBezierPath *myPath = [self generateAPathInBounds:boundingRect]; // ? now I would like to mirror myPath ?
wfbarksdale
  • 7,498
  • 15
  • 65
  • 88
14
votes
4 answers

How to Get the reverse path of a UIBezierPath

self.myPath=[UIBezierPath bezierPathWithArcCenter:center radius:200 startAngle:0 endAngle:180 …
Shubhank
  • 21,721
  • 8
  • 65
  • 83
13
votes
2 answers

Hit detection when drawing lines in iOS

I would like to allow the user to draw curves in such a way that no line can cross another line or even itself. Drawing the curves is no problem, and I even found that I can create a path that is closed and still pretty line-like by tracing the…
EFC
  • 1,890
  • 18
  • 39
13
votes
2 answers

Swift: UIBezierPath Stroke Animation from Center

I've been making a simple UIBezierPath animation with Swift. This path consists on creating a rounded rectangle with a colored border. The animation must be the drawing of the colored border. To do so, I've created a CAShapeLayer with a…
rulilg
  • 1,604
  • 4
  • 15
  • 19
13
votes
4 answers

start and end angle of UIBezierPath?

I have coded as below for half circle in iOS using UIBezierPath and CAShapeLayer. clockWiseLayer = [[CAShapeLayer alloc] init]; CGFloat startAngle = -M_PI_2; CGFloat endAngle = M_PI + M_PI_2; CGFloat width = CGRectGetWidth(imageView.frame)/2.0f +…
Sam Shaikh
  • 1,596
  • 6
  • 29
  • 53
13
votes
1 answer

IOS : Animate transformation from a line to a bezier curve

I would like to animate a straight line curving into a bezier curve (from "_" to "n"), is there a library somewhere that can help me to do it ? I know how to draw a Bezier curve with UIBezierPath, I could redraw rapidly and progressively do the…
Nicolas Henin
  • 3,244
  • 2
  • 21
  • 42
13
votes
6 answers

Drawing a bezier curve between a set of given points

What is the best way to draw a bezier curve, in iOS application, that passes through a set of given points
user462455
  • 12,838
  • 18
  • 65
  • 96