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

Some error? I did exactly as the video taught: - (IBAction)quoteButtonPressed { self.quoteLabel.text = @"A stitc

the preview viewer indicates that there is an error in the space before the "{"

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


@interface ViewController: UIViewController

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

- (IBAction)quoteButtonPressed; {
    self.quoteLabel.text = @"A stitch in time saves nine.";
}

@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 {

    //Add your code below!

}

@end

1 Answer

You need to implement the method in the .m file. You got the error message about the '{' because in your declaration of 'quoteButtonPressed' in your .h file you already have a ; at the end of the statement.