Trying to draw lines


MarkGilbert

New Member
Joined
Mar 14, 2007
Messages
1
Reaction score
0
Hi, sorry to be a pain, i'm new to cocoa and development

I'm trying to draw a line, but nothing appears - here is the source



#import <Cocoa/Cocoa.h>
#import <stdio.h>

int main(int argc, char *argv[])
{

NSBezierPath* aPath = [NSBezierPath bezierPath];

[aPath moveToPoint:NSMakePoint(0.0, 0.0)];
[aPath lineToPoint:NSMakePoint(100.0, 100.0)];
[aPath lineToPoint:NSMakePoint(100.0, 50.0)];
[aPath closePath];
[aPath stroke];


return NSApplicationMain(argc, (const char **) argv);
}



any help would be appreciated

Many thanks
 
Ad

Advertisements

Kaveman

New Member
Joined
Nov 26, 2010
Messages
3,558
Reaction score
49
You are right, why should it? You need a custom NSView to draw into. Then you need to move this code into its drawRec method. Prob need to setFocus and colour, also.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top