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

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