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.