Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

John Randak
John Randak
2,552 Points

declaring Arrays in .m file

Sphere *ball = [[Sphere alloc] init];

    ball.radius = 34;

    NSLog(@"\nball radius %f\n", ball.radius);

ok so we've created an instance of sphere called "ball" and set and logged its the Radius property. how to we set and log the center (which is an array)? I guessed something like— ball.center = {23, 32, 45};

—but that didn't work. help! :)

3 Answers

John Randak
John Randak
2,552 Points

here are the two properties and the method.

@property (nonatomic) float radius; @property (nonatomic, strong) NSArray *center;

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

Stone Preston
Stone Preston
42,016 Points

can you link to the actual challenge please?

John Randak
John Randak
2,552 Points

it's not from a challenge, it is from a video: http://teamtreehouse.com/library/objectivec-basics/introduction-to-objectivec/introducing-property

it ends without declaring and logging the array that is the "center" property. we set ball.radius = 34... but how do we set ball.center (which should have 3 floats)?