我在视图控制器的界面中声明了一个SetBallVisibility方法。
但是,当我尝试在实现中使用它时,我得到一个未声明的标识符错误。我做错了什么?
@interface TimeFrameController : UIViewController {
IBOutlet UILabel *lblTime;
IBOutlet UIButton *btnTimeoutOrRunning;
IBOutlet UILabel *lblMessage;
IBOutlet UIButton *btnNextVisit;
IBOutlet UIImage *picRed;
IBOutlet UIImage *picYellow;
IBOutlet UIButton *btnRed;
IBOutlet UIButton *btnYellow;
IBOutlet UIButton *btnChangePlayer;
IBOutlet UIButton *btnFrameOver;
NSString *Player1Name;
NSString *ActivePlayer;
NSString *Player2Name;
NSString *Player1Col;
NSString *Player2Col;
NSString *ActivePlayerCol;
NSTimer *StopClock;
int *StopClockOffset;
int *StopClockPos;
int *Player1Visits;
int *Player2Visits;
}
@property (nonatomic, retain) IBOutlet UILabel *lblTime;
@property (nonatomic, retain) IBOutlet UILabel *lblMessage;
@property (nonatomic, retain) IBOutlet UIButton *btnTimeoutOrRunning;
@property (nonatomic, retain) IBOutlet UIImage *picRed;
@property (nonatomic, retain) IBOutlet UIImage *picYellow;
@property (nonatomic, retain) IBOutlet UIButton *btnYellow;
@property (nonatomic, retain) IBOutlet UIButton *btnRed;
@property (nonatomic, retain) IBOutlet UIButton *btnChangePlayer;
@property (nonatomic, copy) NSString *Player1Name;
@property (nonatomic, copy) NSString *Player2Name;
@property (nonatomic, copy) NSString *Player1Col;
@property (nonatomic, copy) NSString *Player2Col;
@property (nonatomic, copy) NSString *ActivePlayer;
@property (nonatomic, retain) IBOutlet UIButton *btnNextVisit;
@property (nonatomic, retain) IBOutlet UIButton *btnFrameOver;
//@property (nonatomic, retain) NSTimer *StopClock;
bool *ColoursPicked;
//NSString *ActivePlayer;
NSString *ActivePlayerCol;
- (void)SetBallVisibility;
- (IBAction)NextVisitPressed:(id)sender;
- (IBAction)TimeOutOrRunningPressed:(id)sender;
-(void)StartStopClock:(int)nOffSet;
- (IBAction)ChangePlayer:(id)sender;
- (IBAction)YellowPressed:(id)sender;
- (IBAction)RedPressed:(id)sender;
@end
Implementation
#import "TimeFrameController.h"
@implementation TimeFrameController
@synthesize lblTime;
//@synthesize StopClock;
@synthesize btnTimeoutOrRunning;
@synthesize picRed;
@synthesize picYellow;
@synthesize lblMessage;
@synthesize Player1Name;
@synthesize ActivePlayer;
@synthesize Player2Name;
@synthesize btnRed;
@synthesize btnYellow;
@synthesize Player1Col;
@synthesize Player2Col;
@synthesize btnNextVisit;
@synthesize btnChangePlayer;
@synthesize btnFrameOver;
- (void)updateCounter:(NSTimer *)theTimer {
}
-(void) StartStopClock:(int)nOffSet{
.....
}
- (IBAction)NextVisitPressed:(id)sender{
....
[SetBallVisibility];
.....
}
- (void)SetBallVisibility{
if ((Player1Visits > 1) && (Player2Visits > 1))
{
}
}
干杯
保
答案 0 :(得分:0)
你必须使用
[self SetBallVisibility];
Objective-C中的消息(=方法调用)总是发送给一个对象,这也适用于来自同一个类的方法。