by Prasanna Vignesh
24. January 2009 06:17
After installing iphone sdk, the xcode IDE shortcut is automatically placed on the dock. If it does not appear, you are recommended to create one manually.
Running the XCode IDE wont show up any window, and this may confuse any first time .NET developers. Instead, there is a global menu bar on top of the desktop
that shows the menu of the currently running application. Lame !
Once you find the menu bar, select File > New Project
Then you will be taken to a dialog where different project types are available to choose from. In the left side panel select iPhone application.
Then in the rightside pan we will start with a view based application and press create
Enter helloworld when a name for the project is prompted. The wizard creates a runnable empty project named hello world.
Press the Build and Go button which is a green color play button on the tool bar of the hello world project window…
If every thing was fine, you will see the iPhone emulator running for the first time, then loading your new empty white screen project on iPhone. You can end the project by pressing the iPhone bottom screen button, and then you will see the icon of your application on the iphone emulator.
Now we need to make this empty application into a Hello World application.
Find the helloworldViewController.m file in the project files in the right pan, click on it to view it’s contents in the bottom pan.
Scroll till the last line of the code where u see the line
@end
Paste the following code before the @end line, and press build and go…
You will see an iPhone message box that says “hello iPhone World” :)
Code:
- (void)viewDidLoad {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello World" message: @"Hello iPhone World !"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[alert release];
[super viewDidLoad];
}