Last week we finally got the official Apple iPhone SDK. I’ve spent the last few years as a web developer, but ever since I’ve gotten a Mac I’ve wanted to get back to doing some “desktop” application programming. So I’ve messed around with Cocoa a little but haven’t really gotten past the stumbling stages with Cocoa or Objective C. I guess what I’m trying to say is I’m not a Cocoa programmer yet.
After downloading the SDK I immediately started looking for some code samples. After looking at Apple’s hello world app I was definitely intimidated, I’m sure it was great for someone that knows Cocoa or Objective C. So after hacking around for a bit I created my own hello world app using a UITextView component. Like all truly classic hello world programs it does nothing more than outputting “Hello World!”. Since I’m using the UITextView you can tap the text area and edit the text.
To create this app I started by creating an XCode project named helloworld. You won’t need to touch the main.m or main.h files, only the helloworldAppDelegate.m and helloworld.AppDeleage.h files.
First off I’ve added two lines to my header file:
1 // 2 // helloworldAppDelegate.h 3 // helloworld 4 // 5 // Created by Levi Senft on 3/12/08. 6 // 7 8 9 10 @class MyView; 11 12 25
Next I’ve added half a dozen lines to helloworldAppDelegate.m:
1 // 2 // helloworldAppDelegate.m 3 // helloworld 4 // 5 // Created by Levi Senft on 3/12/08. 6 // 7 8 9 10 11 47
That should give a giant white text box with the hello world text that you can edit.
Feel free to point out any Cocoa faux pas in my code. I’d love to know about anything I can do to write better code.
Tags: Cocoa Touch, iPhone, Objective C, XCode

Hello,
Your code looks greath, but I dont know why doesen´t work.
I had searched a lot for an exemple how can I use a UITextView and nothing, nothing ….
So, please, if you can, send me an email with the whole project to see if I can run it.
thanks a lot,
Costy
btw
my email is sir.costy@gmail.com
Costy,
It appears the wordpress is rewriting my quotation marks to the pretty ones. XCode, or any compiler, will recognizes them as characters rather than string delimiters.
Levi
Hello!,
Hi!,
Good day!,
What about myView class dear.
I am new to iPhone development. Can you give me some idea how to start and where can I find some useful getting started material?
Apple docs don’t even talk about hello world.
Where is the MyView class? I see you import it but where is it? I don’t have it.
Hi I also would like to know how we should implement MyView.
Thanks
Hi Levi,
I want an iPhone App to make a phone call. Is it possible? Most have suggested
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-000-0000-"]]; using this way. But is there any that I can make call from my application, with out going to Phone Application.
Please me help me out of this problem.
[...] URL: http://www.forgeniuses.com/2008/03/12/iphone-hello-world/ VN:F [1.9.3_1094]Rating: 0 (from 0 [...]