Mac Help Forums


Reply
Thread Tools Display Modes

Trying to draw lines

 
New Member
Join Date: Mar 2007
Posts: 1
 
      14th March 2007
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
 
Reply With Quote
 
 
 
 
Senior Member
Kaveman's Avatar
Join Date: Nov 2010
Location: Westland, NZ
Posts: 1,360
 
      13th June 2011
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.
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
draw on photo minoruoishi 2008 Apps 0 24th August 2011 09:10 AM
draw on photo minoruoishi 2008 Mac 0 24th August 2011 09:09 AM
draw on photo minoruoishi 2008 UK Macs 0 24th August 2011 09:07 AM
Software to draw pictures Vinayak Naik Graphics 4 29th March 2005 07:06 AM
Good way to draw a NSBezierPath Loic BERTRAND Programmer Help 0 23rd October 2003 04:23 PM


All times are GMT +1. The time now is 10:25 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
New book about Steve Jobs << take part in it!
Arjan (47 Minutes Ago, 09:37 AM)

Help! Stupid computer is automatically logging me out
Elizaboo (11 Hours Ago, 10:41 PM)

URGENT Help. Crazy talk Mac!
Joeker (12 Hours Ago, 09:42 PM)

PDF Document
yura (22 Hours Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (1 Day Ago, 06:36 AM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51