Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Alex Atwater
Alex Atwater
2,624 Points

"Instance Method"

In Objective-C the teacher keeps saying "Instance Method". For example:


That's like the "skeleton" he gave us of the syntax of an "Instance Method" in objective-c. So what is an instance method exactly?! What else could it be, meaning what if that "-" wasn't there?

2 Answers

When you declare a variable with a class, let's say NSString * aString = @"hello world!"; you are declaring an instance of the class. An instance method is thus a method that is called with that particular instance, or copy, of the class you created. You can imagine a class declaration being the blueprint and the instance being the actual car that is built from it. When you push the gas pedal, you are causing that particular copy of the car to move. Thus the action of pushing the gas pedal is an instance method, since it interacts only with that single copy and not the blueprint itself.

As Justin stated, there is also class method, which is declared by preceding the declaration with + instead of -. A class method is used with the class itself instead of the declared variable/copy/instance of the class.

a + sign before the return type can indicate that it is a class method.