Introduction to Objective C

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 @)

Comments are closed.