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

heyy

Heyy i am having a little trouble ( that is causing so much stress :P ) on the code challenge for building the crystal ball app, it is the last part of understanding views and view controllers titled " CGRect and frame ".. i am asked to "Assign the following coordinates to showQuote button: X: 100, Y: 250, Width: 280, Height: 44" and my error message is "Make sure you are setting the frame property of the button named showQuote!"...

the code i have been using is the following..

  • (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; CGRect frame = self.showQuote.frame; self.showQuote.frame = CGRectMake(frame.origin.x, 250, frame.size.width, frame.size.height); }

5 Answers

This is incorrect:

 self.showQuote.frame = CGRectMake(frame.origin.x, 250, frame.size.width, frame.size.height); }

The challenge states: Assign the following coordinates to showQuote button: X: 100, Y: 250, Width: 280, Height: 44"

CGRectMake takes 4 arguments: x position, y position, width and height. The challenge gives you an x position, y position, width and height.

try

self.showQuote.frame = CGRectMake(x,y,width,height);

but replace the x,y,width height with actual numbers

the only line you should have after the comments in view did load is

self.showQuote.frame = CGRectMake(100,250,280,44);

you dont need

CGRect frame = self.showQuote.frame;

yeah i tried that also but its failing to work :(

link the actual challenge please

thank you so much for the help :) it worked!

no problem