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

San Francisco
San Francisco
28,373 Points

Not sure why I can't get this to pass: quoteLabel.text = "A stitch in time saves nine."

I tried checking the forum for creating an iPhone application with Objective-C but could only find answers in creating an iPhone application with Swift...since the forum cuts off the full name you can't see which one you are in until you click on the answers...anyway, my code is attached can't seem to get past this simple 1 step challenge. Thanks! :)

ViewController.h
#import "UIViewController.h"
#import "UILabel.h"


@interface ViewController: UIViewController

@property (strong, nonatomic) IBOutlet UILabel *quoteLabel;

- (IBAction)quoteButtonPressed;

@end
ViewController.m
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.


}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)quoteButtonPressed {

 quoteLabel.text = "A stitch in time saves nine."

}

@end

2 Answers

Stone Preston
Stone Preston
42,016 Points

you need to reference the property using self. Also remember that string literals being with @. Dont forget your semicolon

- (IBAction)quoteButtonPressed {

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

}