In iPhone Development we use Objective C. Objective C was created in 1983 and it evolve from C and SmallTalk.
In 1988 Next licenced Objective C (for NextStep OS) and in 1996 Apple buys NeXT, and in the next few years they use Objective C in Developing OS X. So, this is why iPhone applications (and any other Apple apps) are build in Objective C.
Objective C is C but with other things added (not changed, added!).
In iPhone Development we also have Cocoa Touch. Cocoa Touch is a API build over Objective C.
In the beginning developers wrote some functions to handle various things like strings, dates, timezones, streams etc, and wrap it up, and they called it the Foundation Framework.
We´ll be programming for iPhone, so it will be useful to have some pre-written user interface elements, and thats been done in Objective C 2 called UIKit Framework, which contains hundreds of classes to building User Interfaces on the iPhone. And programmers kept adding on with things to building maps, games, and working with the address book, working with audio and graphics, hundreds of classes, undress of methods, all wrap up in and they called Cocoa Touch.
Calling a method in Java is different from calling in Objective C
in Java we call: myObject.someMethod();
in Objective C we call: [myObject someMethod];
How about if my method takes and argument?
in Java: myObject.someMethod(arg);
in Objective C: [myObject someMethod:arg];
How about methods that take multiple arguments?
in Java: myObject.someMethod(“this is a String”, 0);
in Objective C: [myObject someMethodText:@"this is a String" someMethodIndex:0];
notice that with multiple arguments the method name changes, and the method name defines what the 2, 3 or 4 methods are.
(note that in Objective C any String must be preceded by a @)
welcome to my 1st tutorial of iPhone Development.
This is a 4 step guide to program your first iPhone App.
1)
Open Xcode, create a new project by selecting New Project and the click on the icon labeled View-Based Application, this is the simplest of all templates. Save your project and you are ready to start.
2)
On the left, you have the Groups & Files Pannel, and in that, you will find the Classes Folder, the folder where you will spend much of your time. This is where most of the code that you write will go, since this is where all Objective-C classes belong, you are free to create subfolder under the Classes folder to help organize your code.
There is also a very important folder that is the Resources folder. Start by clicking on Hello_WorldViewController.xib and that will automaticly open the Interface Builder application.
3)
You can create a simple button either by instantiate and object of type UIButton (like this: UIButton *myButton = [[UIButton alloc] initWithFrame:aRect];)
or dragging a button from a palette of interface objects onto your application´s main window.
Scroll down through the list of objects in the Library paletter until you find one called Label. Drag it to the view pannel, and go back to Xcode, save your project and click on the Build and Run Button. Be amazed, your 1st Application was created. Using the iPhone Simulator, or your iPhone(if your a payed iPhone developer) you will notice that you application has a very bad looking icon. go ahead and open Photoshop and make a nice PNG at 57x57px
Dont worry about rounding edges, cause the iPhone OS will round the edges and give it that nice glassy appearance. Just create a normal flat, square image.
4)
After your masterpiece is done, drag it to the Resources folder in you Xcode Project. Next, we need to specify that this particular image should be used as our application´s icon. To do that, open the Info.plist file in your resources folder. In the Icon file property double click the empty value and type the name of your icon.
Save your project and click on the Build and Run button. While on iPhone Simulator click on the home button of the iPhone simulator, your will notice you now hava a awesome icon.
Congratulations, you got your first iPhone application, and you did note write a single line of code.



