iPhone Programming ... First Step
Saturday, April 09, 2011 Saturday, April 09, 2011
Posted by Programming Documentation Blog
I was reading the previous days about programming using Objective C and how to make iPhone applications. Yesterday I had the first step of creating a simple application. I made a simple application to get a name and display it on a label. And selecting a value from a segment and display it and checking a slide value when moving it.
The main idea in using xCode is to use the MVC. Easily you can design the interface using drag and drop, and then you need to add some code for the controller (view controller).
First we need to define the elements, and we should use: IBOutlet to define any element, so we can connect it to the view (user interface).
So for example
IBOutlet UILabel *myLabel; IBOutlet UITextField *myTextField;
This should be defined at the header file first (.h), and then implemented in the (.m) implementation file.
The functions should be defined using IBAction
Example:
-(IBAction) setLabelValue:(id) senderwe can use id in case we don't know the type of the object, or when we need to know the type of object (int,float,double,date ... etc.)
Full project is available to download at:
First iPhone test application
Post a Comment