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

iOS 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

When 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 :)

Thank you SOOOO much!!! I finally mad it passed it!!!

I 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

So 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.