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

iOS Objective-C Basics (Retired) Introduction to Objective-C Syntax Overview

setCenterAndRadius

At 1:47 the narration talks about creating a function setCenterAnd Radius but actually types setCenter (which we have already defined). Is this a typo?

2 Answers

Stone Preston
Stone Preston
42,016 Points

if you continue watching you will see he adds a second radius parameter to the method so it looks like this:

- (void)setCenter:(NSArrray *)center radius:(float)radius;

thus, you now have a method that sets the center and the radius. this method is different from your setCenter method, which only takes one argument and is named setCenter, whereas this one takes 2 arguments and is named setCenter radius

objective c methods are read from left to right like usual (but you only read the words that come before the colons), so if you wanted it to literally be read as setCenter andRadius you would need to use the following definition:

- (void)setCenter:(NSArrray *)center andRadius:(float)radius;

Thanks for the quick response! I incorrectly assumed that a method name only had one part to it.

Why does Douglass not explain this...my word