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
Mark McCuller
3,539 PointsProblem with Code Challenge in Build a Simple phone App (iOS7) In Getting Started first Badge.
In Getting Started on last Code Challenge: "Assign String to a Label" The question: (Assume we are creating an app to display random quotes. A label property called "quoteLabel" has been created along with an IBOutlet to the THViewController class. Assign the following quote to the "quoteLabel" property - "The road to success is always under construction".) I put this code below in but I keep getting it wrong no matter what I do.
- (IBAction) buttonPressed { self.quoteLabel.text = @"The road to success is always under construction"; }
Best Regards,
Mark
J Marston
4,961 Pointsactually it has, but it is listed in the .h file and not the .m file which the code input takes in. Still not sure I understand here.
2 Answers
J Marston
4,961 PointsMark McCuller - I figured it out:
You should not be including using IBAction or buttonPressed at all. Those were only used in the actual tutorial. In the sample quiz, you are supposed to use the code given within the -(void) viewDidLoad as such:
- (void)viewDidLoad {
....
self.quoteLabel.text = @"The road to success is always under construction";
}
@end
Mark McCuller
3,539 PointsJ Marston,
Thank you for your excellent help, I was stuck for over a day with this problem and I could not go forward. Using your code (self.quoteLabel.text = @"The road to success is always under construction";) makes the answer correct. I will have to think how does this code get tied to the IBAction when a button is pressed. I have a lot to learn but I am enjoying the challenge of learning new skills. Again, Thank you for helping me as I begin to learn IOS programming, it is greatly appreciated.
Mark McCuller
J Marston
4,961 PointsJ Marston
4,961 PointsI am also having the same issue. I did notice the question references IBOutlet which the videos to this point have not yet gone over in stead of the IBAction you are trying to input above.