NSBezierPath is a class responsible for constructing and drawing paths in Cocoa.
Questions tagged [nsbezierpath]
150 questions
0
votes
0 answers
What with start point coordinate on mac os?
What's going on?
I want customize macOS button with swift 3. macOS (0.0, 0.0) point is in bottom left corner. But when I write this code:
let path = NSBezierPath()
path.lineWidth = 2
path.move(to: NSPoint(x: 0.0, y: 0.0))
…

Anthony
- 17
- 8
0
votes
2 answers
How do I control animation timing along a NSBezier path?
In Apple's docs about CAKeyframeAnimation they say:
"For most types of animations, you specify the keyframe values using
the values and keyTimes properties. During the animation, Core
Animation generates intermediate values by interpolating…

Bob Ueland
- 1,804
- 1
- 15
- 24
0
votes
1 answer
addCurveToPoint crashing with EXC_BAD_INSTRUCTION
I'm trying to draw a bezier curve in cocoa and I'm getting a EXC_BAD_INSTRUCTION that doesn't seem to make any sense at all.
here's my code:
NSBezierPath *path = [NSBezierPath bezierPath];
[path setLineWidth: 1.0f];
NSPoint a = NSMakePoint(0,…

megamau
- 33
- 5
0
votes
1 answer
Multiple colors drawn for NSBezierPath in cycle
I have following code in func draw(_ dirtyRect: NSRect) method but all the lines are drawn with the same color even if it should be randomized. I read that it may has something to do with fps but is there any way how to draw it multicolored?
Thanks…

Dawy
- 770
- 6
- 23
0
votes
1 answer
[iOS Objective C]Drag Bezier curve from a point on closed bezier curve path
Sample image for the requirementI have drawn a closed path bezier curve using the UIBezier path code.Im able to find if touched point on screen is on the closed bezier path boundary or outside it.
Requirement:- I need to drag the point where user…

Amit Dhawan
- 11
- 4
0
votes
1 answer
How to get the selected BezierPath on MouseDown or MouseDragged or MouseUp?
I am drawing multiple NSBezierpaths, then I am trying to erase them so on MouseDown event How can I identify which bezierpath was hit?
My bezierpath is custom subclass of NSObject.

Sameer Jagtap
- 146
- 9
0
votes
1 answer
NSBezierPath: How to control numbers of segments with LineDashStyle ?
I want to draw a square, with NSBezierPath. The border of square must to be discontinue so i use dashStyle, but I don't have any control on numbers of segments created.
On Apple documentation the explanation is a bit vague. They said that "When…

C-Viorel
- 1,801
- 3
- 22
- 41
0
votes
1 answer
Smooth curve through 3 NSPoints
NSBezierPath *angle = [NSBezierPath bezierPath];
[angle moveToPoint: NSMakePoint(100, 50)];
[angle lineToPoint: NSMakePoint(125, 100)];
[angle lineToPoint: NSMakePoint(100, 150)];
[angle stroke];
Using this simple code of 3 points, I can connect…

31i45
- 315
- 1
- 2
- 12
0
votes
1 answer
NSBezierPath error with Swift 2
I updated Xcode to the latest version (7.2) and I got the following error:
Use of undeclared 'NSBezierPath'
extension String {
...
}
extension NSBezierPath { //Error here
...
}
How can I fix it?

Geek20
- 673
- 1
- 9
- 18
0
votes
1 answer
How to use bezierPathWithCGPath Swift
I need to make a bezier path, I have the CGPath
the only information I found was this:
Declaration
SWIFT
convenience init(CGPath CGPath: CGPath)
the first is written normal, the second in Italics and the third purple in the developers library
How…

toiavalle
- 414
- 7
- 20
0
votes
1 answer
bezierPathWithRoundedRect: -- odd rendering artefact
I am drawing a simple rectangle with a few rounded corners:
UIBezierPath * p = [UIBezierPath bezierPathWithRoundedRect:outline
byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
…

Dirk-Willem van Gulik
- 7,566
- 2
- 35
- 40
0
votes
0 answers
Drawing NSBezierPath over NSImage not properly updating
I've got a NSStatusBar item I'm drawing an (variable depending on user settings) image onto. After the image is set, I draw a simple rectangle/bezierpath over the image to indicate a sort of progress. The progress/rect seems like it isn't updating,…

Andre
- 1
- 1
0
votes
0 answers
How do I change the stroke and fill colors of a NSBezierPath
I'm trying to draw a partial circle with a NSBezierPath in an Xcode7 playground, and thanks to the answer here and some of the code here I was able to get the shape up...but for some reason, changing the stroke and fill colors is confounding me.…

Steven Hovater
- 1,389
- 2
- 12
- 25
0
votes
0 answers
NSBezierPath does not show
I am drawing some rectangles directly on the main window using NSBezierPath. The drawing code is triggered by a button on the main window. If I click on the button, the drawing code happens, but the drawing does not show on the window. On the other…

wagill
- 57
- 6
0
votes
2 answers
Drawing lines on top of each other
I have an issue with drawing lines on top of each other in OS X. The following code draws a red rectangle and then the same rectangle in green color. I would expect a green rectangle as a result because it is drawn last. I get a mixture of red and…

Mikael Hakman
- 1
- 1