i dont understand these errors

Discussion in 'iOS Programming' started by macfanboy, Aug 4, 2008.

  1. macrumors 6502a

    Joined:
    Jun 5, 2007
    #1
    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?

    Code:
    #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
    
     
  2. macrumors 6502

    Joined:
    Jan 16, 2006
    Location:
    New York, NY
    #2
    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.
     
  3. macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #3
    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".
     
  4. thread starter macrumors 6502a

    Joined:
    Jun 5, 2007

Share This Page