A hello world tutorial for learning basic Objective C in Xcode
For helloworld.h:
#import Cocoa/Cocoa.h
@interface helloworld : NSObject { IBOutlet id display;
}
- (IBAction)buttonPress:(id)sender;
@end
And for helloworld.m:
#import "helloworld.h"
@implementation helloworld
- (IBAction)buttonPress:(id)sender { [ display setStringValue:@"Hello World!"];
}
@end
If you need any other help, just comment and i'll try and get back to you :)
Plz help me man! When I try to join HelloWorld(Object) to the button it doesnt go into buttonPress it just links it to display!!! Plz help somebody! I've fallen into a pit of despair here!
ScrewedUpDNA21 1 year ago
Prob best to learn C! then Objective C the Cocoa...you need to learn the basics first !
lazarus554 1 year ago
THANK YOU. This gave me my first actually working mac program. I had been having a bugger of a time doing it because all hte tutorials are using a different version of Xcode, but this tutorial + a little google on what's changed, plus a littl eplaying around and it worked. I really appreciate it mate!
allenmonroeiii 2 years ago
Great tutorial, it was comprehensive and to the point.
I have very little experience in computer programming, but I wanted to get Xcode and learn Objective C. Are there any tutorial sites or books you would recommend to help me? Some people say to start with regular C code then move on to objective C, so I 'll probably go down that route.
Any advice is appreciated.
dramad33r 2 years ago