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
Austyn Huggins
1,551 PointsiOS 7 beginner course problem
Ok, so I've been having trouble with the last code challenge in the beginner badge in iOS 7. The code challenge is named Assign String to a label it say to do this...
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".
if the label is named quote label then what is the IBOutlet named? is it the same name as the label? because i keep putting this
import "THViewController.h"
@implementation THViewController
-
(void)viewDidLoad { [super viewDidLoad];
// Add your code below! The property for THViewController's // label is named 'quoteLabel'.
-(IBAction)quoteLabel self.quoteLabel.text = @"The road to success is always under construction"; }
@end
Please help any hint or answer will do since I've been stuck on this for 3 days.
3 Answers
Jose Saldana
3,029 PointsWhen entering the code there is no need to add the -(IBAction) This is all that should be required. self.quoteLabel.text = @"The road to success is always under construction";
Remember searching before posting :)
Scott Prock
666 PointsIf anyone comes across this thread, there is a better answer in this one https://teamtreehouse.com/forum/problem-with-code-challenge-in-build-a-simple-phone-app-ios7-in-getting-started-first-badge
Scott Prock
666 PointsI too am stuck on the same step. I would have expected the label to be assigned to a button similar to the steps we have been given so far. So I used the following ...
-(IBAction)buttonPressed { self.quoteLabel.text = @"The road to success is always under construction"; }
That didn't work. So I thought the instructions were talking about assigning a string to a label, so I thought for sure this code would work ...
NSString *quoteLabel = @"The road to success is always under construction";
Still not working ... I can't help but feel there are some pieces missing in the instructions that would make this easier to understand.
Any tips, or a hint would be great ... Thanks
Scott Prock
666 PointsSo sorry, I missed the reply above. Looks like we were on the right track, just need to understand the systax a little better I guess. Thank you.
Austyn Huggins
1,551 PointsAustyn Huggins
1,551 PointsThank you SOOOO much!!! I finally mad it passed it!!!