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 Build a Simple iPhone App with Objective-C Views and View Controllers IBActions and IBOutlets

help please. very stuck

i'm not sure what i'm doing wrong.

2 Answers

Hi there,

In the .m file, where the comment says to add the code, you need to add a line that modifies the text in the quoteLabel defined in the .h file. That looks like:

    self.quoteLabel.text = @"A stitch in time saves nine.";

You access the label with the self keyword then append using dot notation the name of the label, quoteLabel. Then to access the text property, you chain more dot notation onto that. Then you assign the given string to it using the equals sign and not forgetting the @ symbol for the string literal.

I hope that helps.


thank you!

No problem! :-)

Jason Anders
Jason Anders
Treehouse Moderator 145,624 Points

Hey there,

I'm still relatively new to Objective-C and iOS, so I'm not sure how well I can explain this answer.

The challenge wants you to 'add' the text when the button is pressed. So inside the implementation file for ViewController (ViewController.m), you add the text to the quoteLabel. Because you are in the method, you need to use self to assign the text to it. The correct code snippet is below. The only line we added is below the 'add your code here'.

I'm sorry if I couldn't make more sense. I'm just beginning to understand all the "Whys?" myself.

Keep Coding! :)

- (IBAction)quoteButtonPressed {

    //Add your code below!
  self.quoteLabel.text = @"A stitch in time saves nine.";


thank you!