PDA

View Full Version : i dont understand these errors




macfanboy
Aug 4, 2008, 03:47 PM
with this code, i get an error for each button in my header file. i dont see whats wrong. the error is

error: type of accessor does not match the type of property 'easy'.

i have five buttons and this error occurs five times; once for each button. i think ive read it thoroughly but i cant find my mistake. can anyone help me?

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface OneGameView : UIView {
UIImageView *gameImage;
NSTimer *gameTimer;
NSUInteger time;
UILabel *timerLabel;
NSUInteger score;
UILabel *scoreLabel;
IBOutlet UIButton *pause;
IBOutlet UIWindow *window8;
IBOutlet UIView *newGameView;
IBOutlet UIView *pauseView;
IBOutlet UILabel *onePlayer;
IBOutlet UIButton *easy;
IBOutlet UIButton *medium;
IBOutlet UIButton *hard;
IBOutlet UIButton *back;
}

- (IBAction)pause;
- (IBAction)easy;
- (IBAction)hard;
- (IBAction)medium;
- (IBAction)back;
- (void)timer;
- (void)updateTimeLabel;

@property (nonatomic, retain) UIImageView *gameImage;
@property (nonatomic, retain) NSTimer *gameTimer;
@property (nonatomic, retain) UILabel *timerLabel;
@property (nonatomic, retain) UILabel *scoreLabel;
@property (nonatomic, retain) UIButton *pause;
@property (nonatomic, retain) UIWindow *window8;
@property (nonatomic, retain) UIView *newGameView;
@property (nonatomic, retain) UIView *pauseView;
@property (nonatomic, retain) UILabel *onePlayer;
@property (nonatomic, retain) UIButton *easy;
@property (nonatomic, retain) UIButton *medium;
@property (nonatomic, retain) UIButton *hard;
@property (nonatomic, retain) UIButton *back;

@end



johnnybluejeans
Aug 4, 2008, 06:14 PM
Your buttons and actions have the same name. You need to rename one of them.. for instance change your outlet definitions for your buttons to buttonEasy, buttonMedium.. etc.

Sbrocket
Aug 4, 2008, 06:16 PM
with this code, i get an error for each button in my header file. i dont see whats wrong. the error is

error: type of accessor does not match the type of property 'easy'.

i have five buttons and this error occurs five times; once for each button. i think ive read it thoroughly but i cant find my mistake. can anyone help me?

<snip>

Rename your methods to something else. My best guess is that the synthesized getters and setters for your properties are colliding with your methods.

Also, it should be "-(IBAction)methodName:(id)sender" not "-(IBAction)methodName".

macfanboy
Aug 4, 2008, 06:51 PM
thanks for the replies