0
別のメソッドが呼び出されたときに、あるメソッドでタイマーを無効にするにはどうすればよいですか?基本的にはtapFig
が呼び出されたとき、私は私はあなたがtapFig
が呼び出されたときにtrueに設定しますmoveStickFig
内のフラグが必要だと思う、それは目的C:リモートでタイマーを無効にする
-(void) moveStickFig:(NSTimer *)timer {
UIButton *stick = (UIButton *)timer.userInfo;
CGPoint oldPosition = stick.center;
stick.center = CGPointMake(oldPosition.x + 1 , oldPosition.y);
if (oldPosition.x == 900) {
[stick removeFromSuperview];
healthCount--;
NSLog(@"%d", healthCount);
[healthBar setImage:[UIImage imageNamed:[NSString stringWithFormat:@"health%d.png",healthCount]]];
}
}
-(void) tapFig:(id)sender {
UIButton *stick = (UIButton *)sender;
count++;
score.text = [NSString stringWithFormat:@"%d", count];
[stick removeFromSuperview];
[stick release];
}