30 から 0 までカウントダウンするタイマーを作成しようとしていますが、これが機能する唯一の方法ですが、機能しません。誰が私が間違っているのか知っていますか?
.h ファイル
@interface countDownAppViewController : UIViewController {
UIButton *countDown;
UILabel *displayThis;
}
@property (nonatomic, retain) IBOutlet UIButton *countDown;
@property (nonatomic, retain) IBOutlet UILabel *displayThis;
-(IBAction) theCount:(id) sender;
-(IBAction) displayStuff:(id) sender;
@end
.m ファイル
@synthesize countDown;
@synthesize displayThis;
-(IBAction) theCount:(id) sender {
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(displayStuff:)
userInfo:nil
repeats:NO];
}
int batman=30;
-(void) viewDidLoad{
displayThis.text = [NSString stringWithFormat:@"%i",batman];
}
-(IBAction) displayStuff:(id) sender {
while (batman >= 0){
batman--;
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(displayStuff:)
userInfo:nil
repeats:NO];
displayThis.text = [NSString stringWithFormat:@"%i",batman];
}
}