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
4

1 回答 1

0

查看文档,似乎问题在于您fromPoint等于当前点。文档说:

创建的圆弧由内接在三个点指定的角度内的圆定义:当前点、fromPoint 参数和 toPoint 参数(按此顺序)。

所以我认为这意味着fromPoint必须与当前点不同。

于 2014-04-17T04:11:03.983 回答