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 trialkeilanuharriscarroll
18,570 Pointshelp please. very stuck
i'm not sure what i'm doing wrong.
2 Answers
Steve Hunter
57,712 PointsHi 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.
Steve.
Jason Anders
Treehouse Moderator 145,860 PointsHey 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.";
}
keilanuharriscarroll
18,570 Pointsthank you!
keilanuharriscarroll
18,570 Pointskeilanuharriscarroll
18,570 Pointsthank you!
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNo problem! :-)