O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Declaring and Calling Methods

As you have already seen, method declarations are very different from what you’re used to seeing in Java and C#. Objective-C instead uses SmallTalk method syntax. Figure C.1 shows a breakdown of the declaration of a static method that takes two parameters and returns an object of type id.

Image

Figure C.1 Method signature.

There are two types of methods in Objective-C: instance and class methods. Instance methods work on specific objects, whereas class methods are similar to static methods in Java and can be invoked using the class name. Class methods do not have access to any data stored in the class properties.

The return ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required