属性实现必须在接口错误中声明它

时间:2013-03-04 12:17:45

标签: properties implementation

“属性实现必须在接口”错误

中声明

我有这个错误,我是xcode的新手,所以我不确定该怎么做。

我在一个类中有很多代码,然后我把它移到另一个类,现在我有很多错误。这一切都没有意义,因为一切看起来都应该如此。

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize MenuScreenButton;
@synthesize HowToPlayButton;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (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)HowToPlayButtonPressed:(id)sender

{
HowToPlayViewController *HowToPlayView=[[HowToPlayViewController alloc]initWithNibName:nil bundle:nil];
    HowToPlayView.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:HowToPlayView animated:YES completion:NULL];
}

-(IBAction)MenuScreenButtonPressed:(id)sender

{
    MenuScreen *MenuScreenView=[[MenuScreen alloc]initWithNibName:nil bundle:nil];
    MenuScreenView.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:MenuScreenView animated:YES completion:NULL];
}
@end

以下是.h文件:

#import <UIKit/UIKit.h>
#import "HowToPlayViewController.h"
#import "MenuScreen.h"

@interface ViewController : UIViewController
{
    IBOutlet UIButton *HowToPlayButton;
    IBOutlet UIButton *MenuScreenButton;

}



@property(retain,nonatomic) IBOutlet UIButton *MenuScreenButton;

@property(retain,nonatomic) IBOutlet UIButton *HowToPlayButton;

-(IBAction)HowToPlayButtonPressed:(id)sender;
-(IBAction)MenuScreenButtonPressed:(id)sender;
@end

0 个答案:

没有答案