0

I am attempting to draw and arc using "appendBezierPathWithArcFromPoint" but when run, it doesn't draw the arc. The "lineToPont" works and other "NSBezierPath" commands work. Can anyone please help by telling me what I am doing wrong. I have done quite a bit of serching with no clear answer. I am using MAC OS 10.9.2 and XCode 5.1. Below is the snipet of code. Thank You.

#import "MyView.h"

@implementation MyView

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    // Initialization code here.
}
    return self;
}

- (void)drawRect:(NSRect)dirtyRect
{
    [super drawRect:dirtyRect];

    NSRect bounds = [self bounds];

    NSBezierPath *thePath = [NSBezierPath bezierPath]; // all drawing instruction goes to thePath.
    [NSBezierPath setDefaultLineWidth:2.0];
    [[NSColor blackColor] set];
    [thePath moveToPoint:NSMakePoint(0, 0)];
    [thePath lineToPoint:NSMakePoint(100, 30)];
    [thePath appendBezierPathWithArcFromPoint:NSMakePoint(100,30)  toPoint:NSMakePoint(130,0) radius:30];
    [thePath stroke];

} 
@end
user1118321
  • 25,567
  • 4
  • 55
  • 86
Adrian
  • 1
  • 1

1 Answers1

0

Looking at the docs, it seems like the problem is that your fromPoint is equal to the current point. The docs say:

The created arc is defined by a circle inscribed inside the angle specified by three points: the current point, the fromPoint parameter, and the toPoint parameter (in that order).

So I think that means that the fromPoint must be different from the current point.

user1118321
  • 25,567
  • 4
  • 55
  • 86