In this tutorial I will give you a brief introduction on how to get started with your first iPhone application. To begin you will need the latest version of the iPhone SDK which you can download it from here. With the SDK you get some tools like Xcode, Interface Builder, iPhone simulator, and many more. The first application is usually called "Hello World" but I have named my first app "Hello Universe" because a revolutionary device calls for a change of name.
Purpose of the "Hello Universe" app
Using the app a user will be able to enter his/her full name and click a button to see a message appear. The message will say "John Doe says Hello Universe!!!". This app will not only introduce you to some of the tools but will also show you how to use controls, respond to events and create new views. Excited, I am :-)
This is how the app will look like

Creating a new project
Launch Xcode and click on File -> New Project -> Select Application (under iPhone OS) -> select Window-Based Application project template and click on choose.

In the next screen you will be asked to save your project and give it a name. Xcode creates some files for us based on the name of the project, so you want to be careful with the name you provide. I have named my project "HelloUniverse".
This is how the list of files look like in Xcode.

All the class files are stored under the "Classes" folder, some special files are listed under "Other Sources", all the view files and resources show up under "Resources", and any library or frameworks we add to our project are listed under the "Frameworks" folder. It is important that we save all the images, files, databases, and views in the "Resources" folder because all the iPhone apps run in its own sand box; which means they can only access files placed under the resources folder.
How the app is launched
Every C/C++/Java/C# programmer knows about the main method found in main.m file which is present under the "Other Sources" folder. You normally will never have to change this method and all we have to know is that this method is responsible in launching the app. The method applicationDidFinishLaunching method is called when the app is launched on the device or the simulator. The method is defined in "HelloUniverseAppDelegate.m" file which is found under the "Classes" folder.
Interface Builder
Using Interface Builder we can design our application by adding controls or creating additional views. The files that the Interface Builder creates gets saved with a .xib extension and are called nib files. Every project gets one nib file by called which is called "MainWindow.xib" which can be found under "Resources". An iPhone application has only one window (MainWindow.xib) unlike a desktop application which is created with multiple windows; however, we can create multiple views which are added to the window. Double click on "MainWindow.xib" to launch the Interface Builder, which will open four windows and one of the window will look like this

The above picture shows the contents of the "MainWindow.xib" nib file. Every nib file has atleast two files; File's Owner and First Responder which cannot be deleted. Every other objects apart from the first two, represents an instance of an object which gets created when the nib file loads. File's Owner simply shows that it owns the object in the nib file. First Responder tells us which object are we currently interacting with; like the textbox, buttons... The third object which is special to the MainWindow.xib file is called "Hello Universe App Delegate" and this file represents "HelloUniverseAppDelegate" class. Last but not the least the view represents the object which we design in our apps.
Creating a new view
If we had created this project using "View-Based Application" project template then there would have been no need of creating another view from scratch, but where is the fun in that. In Interface Builder create a new view by clicking File -> New -> Select Cocoa Touch -> View and click on choose. Let's save the view in the project folder by naming it "HelloUniverse" and once we do that IB (Interface Builder) will prompt us to add the view to the current project; click on "Add" and it will show up in Xcode. In Xcode and move your view to the Resources folder.
Creating a view controller
We have a view now let's create a view controller to manage the view. In Xcode create a new view controller by selecting classes and clicking File -> New File -> Select Cocoa Touch Classes under iPhone OS -> select UIViewController -> click on choose and name your file "HelloUniverseController" without changing the extension. The newly created class inherits from UIViewController which knows how to interact with a view. Now that we have our view and the controller class, there must be some way to connect these two files and we can do it by setting the class property of the File's Owner. Double click "HelloUniverse.xib" file in Xcode to launch Interface Builder and select File's Owner -> select Tools -> Identity Inspector and under "Class Identity" category, change the class to "HelloUniverseController". This is how the Class Identity should look like

Once that is done we need a way to control the view in the nib file from code and this is done by connecting the view instance variable to the view object in the nib. The connection is made using "outlets". Select Tools -> Connections Inspector create a connection from the view variable to the view in the nib file. Move your mouse over the empty circle to see it change to a plus symbol indicating that a connection can be created. Click on circle and drag your mouse to the view in the nib file and release. As you do this you will see a blue line being created from the circle to the mouse. Once a connection is created, the connections inspector for File's Owner will look like this

Adding controls to the view
From the screen shot above we require two text boxes, one label, and a button (Round Rect Button). From the library drag and drop the controls to the view and align it as seen in the figure 1.0. After you have added the controls let's change some of its properties, starting with the text boxes. Select the first text box and open Attributes Inspector by selecting Tools -> Attributes Inspector. Under Placeholder enter "First name", under "Text Input Traits" change Capitalize property to "Words" and change the Return key property to "Done". Apply the same settings for the other text box but change the Placeholder to say "Last name". Select the label and delete its text property, since we do not want the label to say anything until the button is clicked. Double-click the button to edit the title of the button and type in "Click Me". Save and quit Interface Builder as we have successfully designed our view.
Connecting instance variables to the objects in the view
We still need some way to interact with the controls on the view, in code and this is where outlets help us out. IBOutlet is a special keyword if used with an instance variable, will make the variable appear in Interface Builder. Since IBOutlet makes the variable appear in Interface Builder, using IBAction as a return type for a method will have the opposite effect. Using IBAction we can handle an event triggered by any control placed on the view. Let's see how this works; open HelloUniverseController.h file in Xcode and type in the following code
//HelloUniverseController.h
@interface HelloUniverseController : UIViewController {
IBOutlet UITextField *txtFirstName;
IBOutlet UITextField *txtLastName;
IBOutlet UILabel *lblMessage;
}
- (IBAction) btnClickMe_Clicked:(id)sender;
@end
//HelloUniverseController.m
- (void)dealloc {
[txtFirstName release];
[txtLastName release];
[lblMessage release];
[super dealloc];
}
All the variables above are marked with IBOutlet and Interface Builder will make these available to itself so proper connections can be made. We also have a method whose return type is IBAction (void); Interface Builder will also make this method available to itself so we can choose which event will call this method. The method also takes a parameter called "sender" which is the object which triggered the event. The variables are released in the dealloc method as shown above. Let's connect these instance variables to the controls on the view (HelloUniverse) as described earlier. Open Interface Builder by double-clicking HelloUniverse.xib file and select File's Owner, open Connections Inspector to see all the variables present under Outlets and to create connections.

Let's hook up the button click event to the "btnClickMe_Clicked" method. Select the button and under the Events list it seems that we do not have a button click event; however, we do have a "Touch Up Inside" event which is raised when the button is touched and released symbolizing a click. With the button selected click the circle next to "Touch Up Inside" and drag your mouse over to File's Owner and release to have the method name show; simply click on the method name to create a connection.

Handling events
Let's write some code in btnClickMe_Clicked event to read the first and last name and display a message in the label. This is how the code looks like
//HelloUniverseController.m
- (IBAction) btnClickMe_Clicked:(id)sender {
NSString *FirstName = txtFirstName.text;
NSString *LastName = txtLastName.text;
NSString *Message = nil;
if([FirstName length] == 0 && [LastName length] == 0)
Message = [[NSString alloc] initWithFormat:@"Anonymous says Hello Universe!!!"];
else if ([FirstName length] > 0 && [LastName length] ==0)
Message = [[NSString alloc] initWithFormat:@"%@ says Hello Universe", FirstName];
else if ([FirstName length] == 0 && [LastName length] == 0)
Message = [[NSString alloc] initWithFormat:@"%@ says Hello Universe", LastName];
else
Message = [[NSString alloc] initWithFormat:@"%@ %@ says Hello Universe", FirstName, LastName];
lblMessage.text = Message;
//Release the object
[Message release];
}The method does few simple things, it finds out the first and last names and figures out what message to display in the label. We also create a temporary variable called "Message" to hold the message which will be displayed in the label. The variable is allocated and initialized by alloc and initWithFormat messages respectively. The variable is released in the end because when working with the iPhone we are responsible of cleaning up the memory. The easiest way to remember when to release objects is; if you create it then you own the object and hence you are responsible of releasing it.
If you click on Build and Go, the view will not be visible because we have not yet added it to the window. Let's see how we can do that
Adding view to the window
Now we cannot drag the view and add it to the window, so we need another way to add the view as a sub view to the window. We already know that "HelloUniverseController" is the view controller of the view "HelloUniverse" and "HelloUniverseAppDelegate" is the application delegate where the window is made visible in applicationDidFinishLaunching method. It is in that method we will add the view as a sub view to the window. Before we do that, the application delegate (HelloUniverseAppDelegate) needs to know about our view controller. Add the following lines to HelloUniverseAppDelegate.h file to change the file like this
//HelloUniverseAppDelegate.h
@class HelloUniverseController;
@interface HelloUniverseAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
HelloUniverseController *hvController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) HelloUniverseController *hvController;
@endFrom the above code we first add a forward class declaration of "HelloUniverseController" because we do not want any circular dependency when we import the header file of "HelloUniverseController" in HelloUniverseAppDelegate.m. A variable and a property of type HelloUniverseController is also declared. The property as you can see is declared with a couple of attributes called "retain" and "nonatomic". The retain attribute will increase the reference count of the instance variable by one and nonatomic is used because our program is not multi-threaded.
A lot of first time users miss to synthesize the property we declared, so let's do that now at the top of the HelloUniverseAppDelegate.m file and the code looks like this
//HelloUniverseAppDelegate.m
@implementation HelloUniverseAppDelegate
@synthesize window, hvController;
...
The view is added as a subview to the window in applicationDidFinishLaunching method and this is how the code looks like
//HelloUniverseAppDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application {
HelloUniverseController *hvc = [[HelloUniverseController alloc]
initWithNibName:@"HelloUniverse" bundle:[NSBundle mainBundle]];
self.hvController = hvc;
[hvc release];
[window addSubview:[self.hvController view]];
// Override point for customization after application launch
[window makeKeyAndVisible];
}The second line shows that we imported the header file of "HelloUniverseController" and we also synthesized the property hvController. In the "olden" days in order to create a property we had to create getter and setter methods which would be something like getHVController and setHVController. The synthesize keyword automatically generates these methods for us. In applicationDidFinishLaunching method we allocate and initialize a temporary variable, assign it to our property, release it, and the view associated with the view controller is added as a sub view to the window. The key thing to remember here is that the view message is passed to the "hvController" which returns the view and is added as sub view to the window. A valid view is returned because we created a connection from the view instance variable to the view in the nib file. The property is finally released in the dealloc method as shown below
//HelloUniverseAppDelegate.m
- (void)dealloc {
[hvController release];
[window release];
[super dealloc];
}We have always allocated and initialized variables in one single line as seen below, this is usually the accepted way but the same code can be written in a different way as seen below
HelloUniverseController *hvc = [HelloUniverseController alloc];
hvc = [hvc initWithNibName:@"HelloUniverse" bundle:[NSBundle mainBundle]];Build and go to test your application.
Hiding the keyboard
Wait a minute clicking the "Done" button doesn't do anything. Ideally we would like to hide the keyboard when the "Done" button is clicked no matter which text box we are currently editing. To hide the keyboard we need to do two things; set the delegate of the keyboard to File's Owner and implement a method called textFieldShouldReturn in HelloUniverseController.m file. To set the delegate, open Interface Builder by double clicking HelloUniverse.xib, select the first text box and click on Tools -> Connections Inspector. Click and drag your mouse by selecting the empty circle next to delegate under "Outlets" and release your mouse over to File's Owner. Assign the delegate for the next text box in the same manner.
The method textFieldShouldReturn gets called when the "Done" button is clicked and this is how the code looks like
//HelloUniverseController.m
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
[theTextField resignFirstResponder];
return YES;
}The method gets a parameter called sender, which is the object that triggered the event. We will use the same object to which we send the resignResponder message, which will hide the keyboard on the textbox. The boolean "Yes" is returned to tell the sender that the first responder is resigned.
Conclusion
I hope you had fun with this tutorial and feel a little confident in writing your next great iPhone app. Please leave me your comments and let me know what you thought.
Happy Programming,
iPhone SDK Articles
PS: I have re-written this tutorial hoping it would be easier to follow. If you have any questions please do not hesitate to send me an email here and I will be happy to help you out.
Attachments
Suggested Readings

145 comments:
Nice tutorial!
Thx for your work!
greets from italy
Please keep posting :)
You're the first useful tutorial I have found :)
Thank you for you work in posting this tutorial!
Very helpful :-)
The same here, this is the first tutorial which is up-to-date and good structured... keep posting ;)
thx!!
Good work that may inspire some people to write they own apps, well done.
This is the best tutorial I've read so. It's written in a way a php programer such as my self can understand and follow to learn how to program for the iPhone. Keep up posting!!!
Thanks!
I'm getting 3 errors when I compile:
error: field 'viewcontroller' has incomplete type
error: property 'viewcontroller' with 'retain' attribute must be of object type
confused by earlier errors, bailing out
Hi gishdog
You will get this error if you have missed * before your variable while declaring a property.
So the line should be something like this
@property (nonatomic, retain) UIViewControllerClass *variable.
nonatomic because only a single thread will access this property
retain because we want the property to retain the object during assignment.
Thanks Jai - got it working...
Just added you to my blog - great resource - please keep up the good work.
Any chance you'll get into the interface builder a bit deeper?
Hi nice tutorial thx.. but i get this warning msg which says no initwithNibName:bundle method found
Do you know what that means? I assume it doesnt understand what initWithNibName is.
the text description and the shown pictures dont go hand in hand in some cases - this is a bit confusing.
First of all major kudos!!! Thanks for this its been very educations.
I got all the way thru writing it and get this exception when trying to run:
"HellowView" nib but no view was set
I downloaded your code and could not see any differences between the code xid.
Any suggestions?
This has got me off the ground for how the delegates, controllers, and Interface Builder hang together - I really needed this.
Many thanks for taking the time to do this.
I may have some questions for you :)
These tutorials are very useful. Can you recommend a good book on the interface builder?
Also, I am trying to find a way to append an item number to each cell in a list / table view (as the mail application or the netnewswire app does), e.g.
Inbox (12)
Where '(12)' is right aligned, and in a rounded rect with white on grey background...is this a standard iphone api as various apps seem to do it?
First of all, a HUGE THANKS for an excellent tutorial - the very first useful IB tutorial I've come across.
I wonder if you can help me - every time I press the button, the button turns blue, nothing gets displayed and GDB kicks in with a "Terminating because of an uncaught exception message". I've downloaded your source and it works fine. I've gone over the code, including comparing it to yours several times already and I can't seem to find the bug. I'd appreciate any suggestions you may have...
Hi Tom,
Thanks for your message. Try checking these things
1. In your nib file the File's Owner class is set to your view controller class you created. In my tutorial, this is called "HelloViewController". You do this by double clicking HelloView in resources which will launch the interface builder and select File's Owner and click on Identity Inspector. The Class selected should be the controller class you created.
2. Open the Connections Inspector and you should see a connection from the File's Owner view to the actual view .
3. applicationDidFinishLaunching method should look like this
//Load the view controller from the HelloView nib file.
HelloViewController *vController = [[HelloViewController alloc]
initWithNibName:@"HelloView" bundle:[NSBundle mainBundle]];
//set the view.
self.viewController = vController;
//release the view controller.
[vController release];
//Add the view as a sub view to the window.
//Here we are asking the view controller to get its view and add it as a subview to the window.
[window addSubview:[viewController view]];
// Override point for customization after app launch
[window makeKeyAndVisible];
Let me know if you have any questions.
Hi Chin,
Objective-C is case sensitive. You have 'w' in initwithNibName in smaller case, it should be initWithNibName.
I hope this help.
Thanks,
iPhone SDK Articles
http://www.iphonesdkarticles.com
Hi Frank,
I believe books on iPhone application development are coming out soon. I think you can pre-order it on amazon http://www.amazon.com/iPhone-Open-Application-Development-Applications/dp/0596518552/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1217104533&sr=8-1
If you want to design your table view cell like the mail application, then you need to add a few steps
1. Create a rectangle of some dimensions
2. Create a label out of that rectangle, and set your label properties. Assuming this is the label which shows up on the left side.
3. Give the label a unique tag. Do this by setting the tag property.
4. Add the label as a sub view to the table cell.
5. Initialize another table (one for the right side), set its properties and give this label a unique tag too.
6. Add the label as a sub view to the table cell.
7. Now in cellForRowAtIndexPath, instead of writing to the text of the cell, you will create labels (get the same label from the text) and set the label's text property and return the cell.
I' am in the process of writing an article which shows how to do this.
Thanks,
iPhone SDK Articles
http://www.iPhoneSDKArticles.com
Thanks philip,
You can send your questions to iphonearticles [@] gmail [.] com
It looks like, a connection is missing from the button on the view to a variable in your view controller.
Make sure that
1. You have a variable declared for your button in the view controller.
2. Create a connection from the button to the variable, using Connections Inspector.
3. Create a method handler in your view controller and link up with method defined in the view controller class.
Thanks
very helpful! better than the tutorials from apple
Your line:
@property (nonatomic,retain) HelloViewController viewController;
causes an error and needs to be changed to:
@property (nonatomic,retain) HelloViewController *viewController;
The only thing missing was the *. Other than that, fantastic tutorial.
Nice tutorial, I managed to follow the gist and add some private stuff like a tableview and it works!
BTW,tableview can only handle single columns, anyone can advice how to handle multiple columns and scroll it properly?
Thank in advance,
JT
If there are weird exceptions causing the app to quit, open the debugger. 9 times outta 10, you can probably find the cause there (in my experience as least :)
Thanks for the tutorial. I have a couple of suggestions:
-Make the images full size in the body of the article.
-Have some more screen shots when you're talking about making connections in Interface Builder. I found this section a little bit confusing.
I'm off to read the rest of the articles in the series.
Thanks again!
Hi Stewart,
Thanks for your comment and your time.
I' am thinking about creating video tutorial on how to use the interface builder. I find it hard to write about the Interface Builder, as it is such a visual tool.
Thanks,
iPhone SDK Articles
http://www.iphonesdkarticles.com
great tutorial!!
I had a few issues but Ive been able to find and fix all but one bug:
The text fields seem like they are not accepting the text I type into them. After I enter the text and click the button, the else statement is executed. No matter which text field I use, the same message is always displayed: "Anonymous says Hello Universe!!"
I've gone over the "if else" and "else if" statements and the program runs error and warning free so I don't think it's a code problem. I've compared my HelloView nib with yours and they look the same.
Any ideas?
Great tutorial. First helpful one I've managed to find online yet. Just have a few problems. I ended up with eight errors when launching before adding the protocol. I went through and managed to fix four of them, but four still stop me from launching, all in HelloUniverseAppDelegate.m. There is a "syntax error before 'HelloViewController'" marked on line 1, and the rest seem to be related to viewController. First, 'no declaration of property' on line 4, then "request for member 'viewController' in something not a structure or union" after the line "self.viewController = vController;", and also "'viewController' undeclasred (first use in this function)" after adding the view as a sub view to the window. Any ideas as to what I should check?
In HelloUniverseAppDelegate.m I am getting 3 errors...
"error: 'viewController' undeclared (first use in this function)" at lines 30 and 38
and this after @end...
"error: synthesized property 'viewController' must either be named the same as a compatible ivar or must explicitly name an ivar"
Any idea what might have gone wrong?
To ernest
Hello,
Can you make sure that you have the following line in the header file
HelloViewController *viewController; within braces of the interface, like this
@interface ClassName : NSObject {
HelloViewController *viewController;
}
Thanks,
iPhone SDK Articles
Thanks so much for taking the time and making the effort to create such a helpful tutorial!
Great tutorial! Thnx alot
Great tutorial. I'm going through the entire series you have posted. Good job!
great tutorial, maybe someone can help me with the following
i have a couple of warnings after completing this lovely tutorial.
the two warnings are
warning: incomplete implementation of class 'MyViewController'
warning: method definition for '-displayMessage:' not found
i checked with your source code and it all look the same. i did change the name as you can see. it crashes in the simulator. i think it has something to do with a default view?
warnings are gone, i forgot to connect the textboxes outlet delegate to files owner.
but the app sill quits in the sim, says terminated due to uncaught exception.
remove my last comment, the warnings are not gone.
sorry dude for recalling comments.
Hi Tony,
Can you give me more details on the error. You can send me an email at iphonearticles {@} gmail [.] com.
Thanks,
iPhone SDK Articles
Calvin ,
I had this same problem. Check HelloUniverseAppDelegate.h for errors.
In my case, I had an error on this line:
@class HelloViewController;
got the app to run properly, thanks for the great tutorial. aside from issues getting it to run on my phone.
Your mobile device has encountered an unexpected error (0xE8000001) during the install phase: Verifying application
i cannot seem to get the keyboard to pop up when i click a text box in the sim. (it shows the dial pad) must be something i missed.
Hi, for the step "Connect the controls on the view to the controller objects" I am not seeing HelloViewController as an option in the class drop down. I do see HelloUniverseAppDelegate however.
I've tried going through the tutorial a few times from scratch and still get stuck at this point.
Any ideas or suggestions?
Thanks,
Matt
Hi Matt,
Your XCode project should contain "HelloViewController" class. You can create a new one by following these steps
XCode -> File -> New Class -> Select UIViewController subclass.
Thanks,
iPhone SDK Articles
This is by far the best iPhone tutorial for beginners. It's simple. It does something. And it works!!!
Thanks for starting me on my journey.
Here were the 2 corrections it required for me:
Adding the * before viewController in the @property statement
@property (nonatomic, retain) HelloViewController *viewController;
And case consistency of viewController everywhere.
Good luck everyone !!!
Hi
I am facing the same issue as Matt, where the HelloViewController does not shows as an option of the class drop down. I actually typed in the class name on the box and can see the lblMessage, txtFirstName and txtLastName in the outlets, but can not see the other ones, hence can not drag the view.
By the way, I did created the class HelloViewController on the project as per the instructions, in fact I can see it listed on the classes of the project on xcode.
Not sure what I am doing wrong, your help would be greatly appreciated.
Regards
AVL
Cool !
if i wanted to make pressing the button also returnTextField - so for example if i didn't click Done, i just hit the Click ME!!! button - it would also hide the keypad. what would i need to do ??
thanks for these cool tutorials... i feel like i've actually learnt something today !
previous comment!
nevermind, i figured it out!
i added
[txtFirstName resignFirstResponder];
[txtLastName resignFirstResponder];
to the Action function !
seems to work :)
For those who did not find the HelloViewController in the drop down box, delete your HelloView.xib and recreate it.
You may have noticed along the way that the TextInputTraits section wasn't there.
I'm not sure what caused the error, but this process worked for me.
Vishay (nihalani at berkeley dot edu)
P.S. Thanks for the great tutorial!
Thank you so much. You're missing a '*' next to viewcontroller property line. Other than that, AWESOME write-up!
Better tutorial than the tutorials that were in the book I bought on iPhone OS Development
I am having trouble. Can someone post code that works so I cn see where I went wrong?
Thanks.
Hi,
QQ: can someone explain to me why in the dealloc method of the HelloViewController sFirstName and sLastName are not being released? I would of thought that even with copy their retain count is being increased, no?
Thanks in advance!
To Nils,
Yes sFirstName and sLastName should have been released in the dealloc method.
I will update the code and the screenshot as soon as possible.
Thanks,
iPhone SDK Articles
UITextFieldDelegate declaration is not complete. Could you, please, show the rest of it?
Thanks for the good work. I'm from the VBA/VB/.NET world. Does anyone know why it takes so many lines of code to accomplish this hello world task while in VB or Java it would only take about one line?
Is there a possibility that Apple will change the language to something a little easier?
Hopefully, I'm just getting over the learning hump and will find the development a lot easier.
Kind comments please.
Thank you,
NIce tutorial.
keep posting new tutorials like this.
I tried in so many places to get a example to see events, but i didn't got. This is the tutorial helped me.
Hi, I am a total beginner in programming and find this tutorial great, although there are parts I don't understand:
Why do you use a temp variable in the viewcontroller.m file when you could directly play with txtFirstName.text and lblMessage.txt?
Maybe stupid question, but I managed to get the program working without so I am wondering what is the advantage of such a temp variable?
Very good tutorial thank you!
This is a great tutorial. Coming from a ActionScript background I found the speed of this tutorial perfect for learning. Thanks. I would also recommend reading this page if you are not familiar with objective-c.
http://developer.apple.com/iphone/gettingstarted/docs/objectivecprimer.action
Fantastic tutorial, didn't know C or Objective-C, and had been really frustrated trying to sift through the Docs for simple things like this program does! finally broke through the wall and got this running after some troubleshooting with some help from the comment section. The case sensitivity of Objective-C was unknown to me, and I goofed up the viewController once or twice as viewcontroller.
The interface builder is still a little mystifying, but I'm looking forward to further tutorials to help with that.
I liked your images of the code instead of letting us copy-and-paste, as this forced me to slow down and read what I was typing in, along with your excellent commenting!
Great job!
I'm having the same problem as one of the anonymous posters, where I get an uncaught exception when I try to run the app. It fails on the [window addSubview:[viewController view] line. Did you resolve this Anonymous?
I also ran into the issues of not seeing the Text Input Traits, iphone simulator crashing, not finding the HelloViewController class. The problems was that when I created the HelloView nib file I accidently created a Cocoa View rather than a Cocoa Touch View. By correctly creating the Cocoa Touch View all my problems were solved
A Well guided tutorial for the beginners..!!
Thanx for ur work..!!
A quick update and something for tom, matt and avl concerning the issue of not being able to see the HelloViewController as an option in the class drop down in the Inspector.
When creating the view in the Interface Builder, make sure to create the "Cocoa Touch > View" and NOT the "Cocoa > View". Those are 2 difference View objects with the latter seeming to be the one causing people not seeing the HelloViewController in the drop down menu.
I hope that helps.
And kudos on the tutorial! It was great :).
I tried and tried but was unable to get this program working. The errors were all in the delegate.m file.
A good tutorial overall but I just couldn't get the thing working. I even copied your source code directly and checked all of my connections.. better luck next time I guess..
Very good Tutorial. It helped me a lot.
A Question to applicationDidFinishLaunching method
Why can't i assign the new viewController object directly to the viewController pointer, like this:
self.viewController = [[HelloViewController alloc]initWithNibName:@"HelloView" bundle:[NSBundle mainBundle]]
instead of creating the new HelloViewController pointer *vController ?
2.Question
I have read in many forums that creating views and viewControllers should created rather programmatically in Xcode than in Interface Builder.
Is this true?
Thanks for the tutorial, really helpful
Thank you very much for writing this tutorial, it helped me a lot.
Very helpful -- thanks for all your work!
A few random comments below, some of which have already been made.
.....................
- PNGs or GIFs might work better for the screenshots than JPEGs
- Inline screenshots might be better full-size (I'm pretty sure you can do this in Blogger)
- I think you should emphasise that Cocoa Touch, not Cocoa should be selected for the project -- both when the project is created and when building HelloView.xib
- 'Also we have three properties to hold the text fileds' should be '... fields'
- viewcontroller should be viewController throughout
- This screenshot should have an asterisk before viewcontroller: http://bp2.blogger.com/_ph0BNaSqIwI/SG1-XoBB5GI/AAAAAAAAAlk/CBp4-cPqoxA/s1600-h/HeaderDelegateFinal.jpg
- "Next to the view you see an empty circle, click the circle and drag it over to the view and release ... To do this click on view and select Connections Inspector, here we will see all our variables defined and it will look something like below" -- I think this is a bit unclear and (as I remember) you need to click on File's Owner to see the stuff you're referring to
- "To do this select the view and its connection inspector. There will be event called 'Touch Up Inside' which is the button click event": need to specify that the txtFirstName text field needs to be selected.
- In general, I think the references to 'view' could be clearer, i.e. do you mean the View window, or the View icon in Interface Builder, or ...
....................
Thanks again.
Sam
krammark23 - thanks for that info, indeed I added the wrong view as well!
Nice Tutorial! Thank you. I made the same mistake as some others. I used Cocoa-->view instead of Cocoa Touch. So I deleted HelloView and made new one with Cocoa-->view. Now when I build and go the simulator crashes... any comments? BTW I am not getting any errors or warnings. Thanks!
Wow. Amazing tutorial!
I want to second and re-quote what was said earlier:
"When creating the view in the Interface Builder, make sure to create the "Cocoa Touch > View" and NOT the "Cocoa > View". Those are 2 difference View objects with the latter seeming to be the one causing people not seeing the HelloViewController in the drop down menu."
Made the same mistake as gishdog... with an incomplete type forgetting the * before the variable. Works now... All is working except one darn syntax error 'before' if.... I can't find it and it's killing me... any help here would be appreciated.
In the HelloViewController.m
------------
#import "HelloViewController.h"
@implementation HelloViewController
@synthesize txtFirstName, txtLastName, lblMessage, sFirstName, sLastName;
- (IBAction) displayMessage:(id)sender {
//Get the first/last name and store it in the varialble.
self.sFirstName = txtFirstName.text;
self.sLastName = txtLastName.text;
}
//Declare a temp variable.
NSString *sTemp = nil;
//If firstname is empty and last name is not
if([self.sFirstName length] == 0 && [self.sLastName length] != 0) {
When I try to create a project using Xcode, there is no option to create a Window based project. Can you please help?
Hi. My HelloViewController appears under the File Owner's in the MainWindow nib file. I don't know why. Any suggestions to move it to the HelloView.xib ?
Thank you for your nice tutorials !
Humberto
@Chase I guess you do not have the iPhone SDK installed, you can get it from here
http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_for_iphone_os_2.2__9m2621__final/iphone_sdk_for_iphone_os_2.2_9m2621_final.dmg
Happy Programming,
iPhone SDK Articles
You should be able to drag and drop teh file in XCode
@Sam can you email me your code and I will be happy to take a look at it.
Happy Programming,
iPhone SDK Articles
@John,
Don't know why the simulator would be crashing, can you email me your code and I will be happy to take a look.
Happy Programming,
iPhone SDK Articles
@dagrt Regarding first point, there is nothing wrong with your code and second I think it's a matter of choice but yes if your view is complex then you are better of creating the view in Xcoce.
Does anyone else only have the numeric keyboard showing? I don't get alpha.
Hi,
Is this tutorial still compatible with the latest iPhone SDK? I'm using Interface Builder v3.1.2 and worked up to the point of naming the first text field but I can't see any of the following options...
Under Text Input Traits select Words for capitalize, Name Type Phone Pad for Type and Done for return key. Also select "Clear Context before Drawing" under view. This will clear the text before rewriting. Apply the same settings for the second text field as well but enter "Last Name" for placeholder.
Are these supposed to be within the same inspector?
Thanks,
To Sam: It looks like you've got a curly brace in their prematurely
@synthesize txtFirstName, txtLastName, lblMessage, sFirstName, sLastName;
- (IBAction) displayMessage:(id)sender {
//Get the first/last name and store it in the varialble.
self.sFirstName = txtFirstName.text;
self.sLastName = txtLastName.text;
}
//Declare a temp variable.
NSString *sTemp = nil;
JAI,
I did everything but when pressing Build and Go I get a black screen.
Any idea why?
Thanks
hi i got this code work. but it display only a black screen in my simulator. why i dont know.. pls help me to get this application work. thanks:)
hi first i wish to say thanks 4 this nice article.
i completed successfully, but i get an empty black screen when i build this application, after few seconds it terminated with__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__. pls. help me to run first application.
thanks 4 ur guidance...
@bala can you email me the source code and I will be able to help you better.
Happy Programming,
iPhone SDK Articles
@Agustin sorry about the trouble, can you send me an email and I will be able to help you.
Happy Programming,
iPhone SDK Articles
hi thanks 4 ur reply...
i got that code is now working , i dont know what i corected in the code. thanks for this nice article....
i have one more doubt, is it posible to do the first iphone application without using the interface builder? if yes mean, help me to do, i say thanks in advance 4 ur help...
one more help i need, any one can help me to develop a simple web browser for iphone...,
pls. help me to do a simple web browser without using interface builder/ or using with interface builder.
thank u lot...iphone SDK articles...
great tutorial man.. easy to follow. I also would recommend the full screen shots on the same page so that you dont go back and forth all the time. Other than that it's great.
thanks a lot
Thanks for the tutorial. The only troubles I had were some misspellings, the missing * mentioned in another comment, and the fact that when I created another view, since there was no details about the kind of view, I created a Cocoa one instead of a Cocoa touch, (it was the one selected by default), which gave me a different set of controls, and at the end I was not able to connect it with the controller. It took me some time to realize why and restart the view of the correct type.
Thanks for the tutorial. The only troubles I had were some misspellings, the missing * mentioned in another comment, and the fact that when I created another view, since there was no details about the kind of view, I created a Cocoa one instead of a Cocoa touch, (it was the one selected by default), which gave me a different set of controls, and at the end I was not able to connect it with the controller. It took me some time to realize why and restart the view of the correct type.
Jai -
Great tutorial! Followed it slowly, and was successful on my firs try! A few questions about the application and steps:
1) Can you explain the "File's Owner" nomenclature? I don't understand how this relates to the app.
2) Why are there 2 views for this application? We worked in the HelloView.xib file for all of the tutorial - what does the app do with MainWindow? Why is it a part of our app if we don't use it? I understand that it must be there for a reason... and it's doing something... I just can't figure it out.
3) The final step - making the keyboard disappear. I can only get it to disappear on hitting 'return' - "click me" doesn't make it disappear. Did I miss something? How would you make it disappear when pressing the 'click-me' button?
thanks!
mark
@bala It is possible to do it without the IB. All you have to do is inherit from the right class like UIWebView to display a web view on the view.
Happy Programming,
iPhone SDK Aricles
@bala I have a tutorial on the Web View object here http://www.iphonesdkarticles.com/2008/08/uiwebview-tutorial.html
Happy Programming,
iPhone SDK Articles
@Mark All iPhone applications have one window, where all of our views are placed. Think of the window as the base container. A desktop application has multiple windows, but iPhone application only has one.
Keyboard disappears by sending the "resignFirstResponder" message. So in the method call "resignFirstResponder" like this
[keyboardVariable resignFirstResponder];
File's Owner is what links the code and the view in Interface Builder. You can create the view in code itself, to avoid configuring the File's Owner.
Hope these answers help you. Please let me know if I can be of any help.
Happy Programming,
iPhone SDK Articles
Very nice tutorial. I know a little tiny bit of Obj-C and have made a few simple applications before but I have been looking into coding for the iPhone and these tutorials are great. My app crashes the iPhone Simulator. It goes into a black screen and then it crashes. I though that I had done something wrong so I downloaded the source code and it did the same thing. I dont know what I could be doing wrong.
Thanks
Never mind. I looked at the console and noticed that even though I uninstalled the app and quit the simulator my original app was still attempting to run in the background. So after I closed down XCode, the Sim and erased the build folder. Then I was able to rebuild the app and run it successfully in the Simulator from the source code download.
My one criticism is that the Interface builder connections explanations where a little hard to follow and I have a feeling that that is where my original application went wrong.
Thank you.
Is there any way I can download the code of this application? For some reason I cant run though I followed all the steps. Looks like I missed a step or 2.
@Yakshagana You can download the source code here http://sites.google.com/site/iphonesdktutorials/sourcecode/HelloUniverse.zip
Thanks a lot for the tutorial! I'm also having issues running into the black screen. It's happening because I've run into this exception:
2009-02-03 23:54:01.874 HelloUniverse[1971:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "HelloView" nib but the view outlet was not set.'
It looks like this message occurs when the viewcontroller is not hooked up to the view. However I have linked HelloViewController's view outlet to HelloView many times making sure they are associated. Have you seen this error message before? Any ideas?
Thanks again for the great write-up,
Anthony
Ah I got it! I was right about the error message and the black screen. The view was not hooked up to the view controller. The reason I was getting the error message is that I didnt save the changes I was making in the Interface Builder. I figured that 'Build and Go' would save the *.xib files as well as the source, but it only saves the source. So just make sure you save your changes in both programs!
I followed your instructions, "Go to Xcode and drag your view under resources. This is where your nib files should be placed." A few steps later I compiled and ran the code, and saw, "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named" etc. Deleting the reference from the resources group (while retaining the actual file and its reference in the NIB Files group) fixed the problem.
Really nice tutorial. I just spent the last week pouring through the iPhone developer documentation and videos to cover the fundamentals. Having this walk through really helped me understand the work flow involved.
For those of you having trouble finding the HelloViewController in the drop down, or setting up the connections, make sure it was a "Cocoa Touch View" that you created as opposed to the "Cocoa View". I made this mistake but was able to fix it by deleting the original HelloView.xib and recreating it.
yup need to add * in line given below in the code for viewcontroller.
@property (nonatomic, retain) untitledviewcontroller *viewcontroller;
Nice article!
Sam Shaw
iPhone Application Developer
nice tutorial..
there is another error on the tutorial on file "HelloUniverseAppDelegate.m" you should
put #import "HelloViewController.h" after #import "HelloUniverseAppDelegate.h" declaration..
it's really a nice job..
congrats..
Tony.
@Black Screen Folks
I was getting the black screen too. Now, I don't know how many different factors can cause this problem, but I found a small discrepancy between the project I created following this tutorial and the downloaded source code. Once I fixed my source, it worked perfectly. ->In the AppDelegate header make sure that you don't use the IBOutlet when using the property directive for the window object. E.G:
@property (nonatomic, retain) IBOutlet UIWindow *window;
Should be:
@property (nonatomic, retain) UIWindow *window;
I hope that helps,
-Nick
Hello there. I tried adding manually in your code , some txt field using floowing code and ofcourse I defined variable of UITextField *textFieldSecure in header file and synthesized it in .m file. but all it shows me is the blank white screen, can you please help me about how to add UITextField manually ? or what am I missing in my code.
[code]
- (UITextField *)createTextField_Secure
{
CGRect frame = CGRectMake(50.0, 50.0, 50.0, 50.0);
textFieldSecure = [[UITextField alloc] initWithFrame:frame];
textFieldSecure.borderStyle = UITextBorderStyleBezel;
textFieldSecure.textColor = [UIColor blackColor];
textFieldSecure.font = [UIFont systemFontOfSize:9.0];
textFieldSecure.backgroundColor = [UIColor whiteColor];
textFieldSecure.keyboardType = UIKeyboardTypeDefault;
textFieldSecure.returnKeyType = UIReturnKeyDone;
textFieldSecure.secureTextEntry = YES; // make the text entry secure (bullets)
textFieldSecure.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right
return textFieldSecure;
}
- (void)loadView {
textFieldSecure = [self createTextField_Secure];
}
[/code]
Hello All,
I have re-written this tutorial hoping it would be easy to follow. I know writing your first iPhone can be a huge task but trust me it gets easier :-)
Thanks for all your support.
Please let me know if you have any questions/comments with the new tutorial and the source code.
Happy Programming,
iPhone SDK Articles
@reetu is it possible for you to send me your source code so I can take a closer look?
Happy Programming,
iPhone SDK Articles
Thank you very much for posting this tutorial. I just started using it last night and was having some issues getting it to work. Now I see that you have redone the posting and it looks even easier to follow.
How i send the app to a real iphone?
@fabio you need to sign up for the developer program http://developer.apple.com/iphone/
Happy Programming,
iPhone SDK Articles
Great tutorial. I have never worked with Objective C before and after a few times trying i was able to follow this and create my first iphone app. I would like to learn about getting long. and lat. of the current iphone location and display on screen or open google map with current location. Anyone got tutorial for location based services. Apple's one is not clear why we are doing this and how if you see what I mean...
A great tutorial for newbies. A need taking into account how difficult it is for a non programmer to approach building an IPhone App. Thx.
Hiya,
Firstly congratulations for creating great tutorials!
However, I first began following this tutorial a few weeks ago, and came back to it today to discover the tutorial had been re-written!
Unfortunately, whilst before I was following the tutorial perfectly I'm now finding it impossible to complete! I'm finding it unclear where exactly code should be placed, and I keep getting build errors! I've had to restart the tutorial twice now and am still not getting it! The code samples you give do not show how this code fits in with the existing automatically generated code! It is my assumption that where you use //HelloUniverseAppDelegate.m, for example, the code should be placed in this file. But should this be instead of the code there, or as well as? I'm getting build errors on automatically generated code such as #import "HelloUniverseAppDelegate.h" in the AppDelegate.m file! It's all getting a little frustrating and I'm getting close to giving up...
I hope perhaps you may be able to make things slightly clearer for beginners?
Thanks very much!
Hey, I had a question. Does anyone know where to add the code for btnClickMe_Clicked? Is it in HelloUniverseController.m?
Thanks in advance.
@Kakei Yes you would write the code for btnClickME_Clicked in "HelloUniverseController.m" file.
Happy Programming,
iPhone SDK Articles
@Alibob150 Sorry you had trouble following this tutorial. If you would send me an email I will be happy to answer your questions and look at your code.
Happy Programming,
iPhone SDK Articles
Easily the most useful information I've come across so far. Thanks for putting this site together. I managed to get this app running with no errors the first time through.
Only potential for confusion I could see: in the "Connecting instance variables to the objects in the view" section, it doesn't seem clear that you also have to connect the text field instances to the corresponding variables in File's Owner (though it is somewhat obvious).
I am curious, as another reader asked, is there any reason when allocating an object to first assign it to a temporary local variable, only to then immediately assign it to the instance variable? For example, in the applicationDidFinishLaunching method for the hello universe controller object. Seems more elegant to just assign directly to the self variable?
Would you mind making the original tutorial available? I was able to get that one to work. I referred a friend to your site, but this version seems to be missing some steps that made the original one more clear. Thanks.
@gecko Glad you found this tutorial helpful.
It is a good idea to create a temporary variable and then do the assignment rather then initialize the variable directly. The reason, memory is very expensive on the iPhone and there is no automatic garbage collection.
Try this code out
self.hvController = [[HelloUniverseController alloc]
initWithNibName:@"HelloUniverse" bundle:[NSBundle mainBundle]];
NSLog(@"Reference Count: %i", [self.hvController retainCount]);
Here the object is initialized directly but its reference count is 2 instead of one. So when this object is released it will decrease its count by one. This means this object will still be in the memory after the application exists causing a memory leak.
I hope this helps.
Happy Programming,
iPhone SDK Articles
I think I have an old copy, please send me your email address and I will be happy to email it to you. Feel free to send me an email with any questions you have, I may take some time to reply but I will reply.
Happy Programming,
iPhone SDK Articles
Sohbet,chat
Thx for this tutorial. I'm total beginner and this helps a lot!
thx a lot. I'm total beginner and it helps a lot!
Article doesnt mention:
// HelloUniverseAppDelegate.m
#import "HelloUniverseAppDelegate.h"
#import "HelloUniverseController.h";
@implementation HelloUniverseAppDelegate
@synthesize window, hvController;
...
Hi,
This tutorial really is truly excllent in explaining the concept of apps in terms of views for newbies like me. The unfortunate thing is I tried it 3 times and I get the same problem. All the simulator shows is a black screen and Xcode shows an exception: __TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__
Any guidance on the matter? I could post my code.
Thanks,
Manny
@dmx You can send me an email with the code and I will be happy to help.
Happy Programming,
iPhone SDK Articles
Each time I try to Build and Go I get the following error within HelloUniverseAppDeligate.m
- (void)dealloc {
Fatal error: method definition not in @implementation context
[hvController release];
[window release];
[super dealloc];
}
How do I fix this?
@Anonymous All the methods should be implemented in .m file. It looks like that dealloc method is declared in .h file but it should be in .m file.
Hope this helps.
Happy Programming,
iPhone SDK Articles
I keep getting stuck at the end of the "Create a view controller" step because every time I do this, only navigationItem and tabBarItem come up as Outlets. Furthermore, when I continue on despite this, I can not link my Touch Up Inside to File's Owner. It doesn't accept it as an option and won't highlight it when I drag over it. Please help.
Good article, but as others have said there are some missing information:
In HelloUniverseAppDelegate.m you need this line next to the other import:
#import "HelloUniverseController.h"
Also you need to synthesize the hvController:
@synthesize window, hvController;
Also, the article skips the step where you connect the reference outlets to the IBOutlets. You need to open the connection inspector and drag the connection between the controls for txtFirstName/txtLastName/lblMessage.
Aside from these issues, great tutorial.
hey, loved the tutorial! Just one little problem though..
- (IBAction) btnClickMe_Clicked:(id)sender {
NSString *FirstName = txtFirstName.text;
NSString *LastName = txtLastName.text;
NSString *Message = nil;
if([FirstName length] == 0 && [LastName length] == 0)
Message = [[NSString alloc] initWithFormat:@"Anonymous says Hello Universe!!!"];
else if ([FirstName length] > 0 && [LastName length] == 0)
Message = [[NSString alloc] initWithFormat:@"%@ says Hello Universe", FirstName];
else if ([LastName length] > 0 && [FirstName length] == 0)
Message = [[NSString alloc] initWithFormat:@"%@ says Hello Universe", LastName];
else
Message = [[NSString alloc] initWithFormat:@"%@ %@ says Hello Universe!", FirstName, LastName];
lblMessage.text = Message;
[Message release];
}
When I execute that code, XCode says execution 'stopped at breakpoint 1' (which apparently is lblMessage.text = Message;). Why does it do this?
Also, the
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
[theTextField resignFirstResponder];
return YES;
}
doesn't seem to work either. I'll post more code if it helps :)
Thanks
Thank you so much. This has been absolutely invaluable in helping start on the road to developing with the SDK.
[quote]Article doesnt mention:
// HelloUniverseAppDelegate.m
#import "HelloUniverseAppDelegate.h"
#import "HelloUniverseController.h";
@implementation HelloUniverseAppDelegate
@synthesize window, hvController;[/quote]
This is crucial - thanks for posting!
It's obviously missing in the original Article causing the simulator to crash...
Apart from that - I still don't get it... Guess I have to read a book about Objective C... :)
The tutorial forgets to mention that the File owner need to bind outlets to all the text fields. I can get the whole thing to work using UITextField objects for both the input and output. However, the tutorial says to use a UILabel object for the output, which does not appear to work. A UILabel does not appear to be a valid outlet for bindings... does something need to be set to make the UILabel dynamic, or am I missing something obvious? Thanks, otherwise, really helpful tutorial.
Hello. This is really great stuff. Very informative and easy to follow. With that said, I actually have a problem that is not shown here.
"variable to the view object in the nib. The connection is made using "outlets". Select Tools -> Connections Inspector create a connection from the view variable to the view in the nib file. Move your mouse over the empty circle to see it change to a plus symbol indicating that a connection can be created. Click on circle and drag your mouse to the view in the nib file and release. As you do this you will see a blue line being created from the circle to the mouse. Once a connection is created, the connections inspector for File's Owner will look like this."
When I do this, and i drag the circle to the file's owner, the box doesn't appear to link them, thus no methods are shown. Any Idea what I could have done wrong?
Hi, I have a question, why is that yours shows "done" on the keyboard, but mine shows "return" on the keyboard (on the simulator). Is there anything I need to configure?
Hi I am curious if there is anything I need to set/config in order to get "done" on the keyboard instead of "return". Mine shows "return", but when I run your code it shows "done" instead. Hence, I am very curious about it.
Thanks.
I downloaded and installed Xcode but I do not have the iPhone OS option. What now?
One of the neat & best iPhone dev tutorials!! Good Work.. Please keep writing more tutorials!!
Man, if not by this, how am I supposed to know all these things? Thank you very much for creating the step-by-step that Apple itself didn't do.
Hi!! :)
First of all... this is GREAT!
Thank you for this tutorial...
even if it doesn't work for me =)
This is what I get in the console:
2009-04-29 23:57:29.172 HelloUniverse[29346:20b] *** -[HelloUniverseAppDelegate setHvController:]: unrecognized selector sent to instance 0x5234c0
2009-04-29 23:57:29.173 HelloUniverse[29346:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[HelloUniverseAppDelegate setHvController:]: unrecognized selector sent to instance 0x5234c0'
2009-04-29 23:57:29.175 HelloUniverse[29346:20b] Stack: (
2489135371,
2451058235,
2489164554,
2489157900,
2489158098,
9560,
816111650,
816149355,
2502230574,
2488638245,
2488638680,
827745792,
827745989,
816114848,
816160924,
9380,
9234
)
Sorry for the long log... Hope you can help me!
There is a statement:
"Let's connect these instance variables to the controls on the view (HelloUniverse) as described earlier"
You might want to call that out a bit more. It's one line buried in a paragraph. Without connecting the instance variables to the controls on the view, no data is passed :)
-----------------------
@Davide:
You need to add the synthesize line that other folks have mentioned. The example is still missing it:
// HelloUniverseAppDelegate.m
@synthesize hvController;
That line adds setters and getters to hvController.
Post a Comment