Basic Cocoa App

July 14th, 2009 -- No Comments

Well I started looking into Cocoa programming so I could develop some Mac applications. So here is my first tutorial on how to develop using Objective-C language.



I will post the Hello.h and the Hello.m files cause I know they are tuff to read.

Hello.h

//
//  Hello.h
//  HelloWorldApp
//
//  Created by John Costanzo on 7/13/09.
//  Copyright 2009 JC Web Concepts. All rights reserved.
//
 
#import
 
@interface Hello : NSObject
{
IBOutlet NSTextField *textField;
}
- (IBAction)sayHello:(id)sender;
 
@end

Hello.m

//
//  Hello.m
//  HelloWorldApp
//
//  Created by John Costanzo on 7/13/09.
//  Copyright 2009 JC Web Concepts. All rights reserved.
//
#import "Hello.h"
 
@implementation Hello
 
- (IBAction)sayHello:(id)sender
{
	//Say Hello
	[textField setStringValue:@"Hello, World!"];
}
 
@end

I hope this has helped you with getting the basic of Xcode and developing an application for the Mac. My next video on this will be tweaking the GUI to look a little better.

Categories: Objective-C