Mon compte à rebours ne fonctionnera pas. Cela a commencé avec '99' sur l'écran et ça s'arrête là. Ça ne bouge pas du tout.Le compte à rebours ne fonctionnera pas
Dans mon fichier d'en-tête.
@interface FirstTabController : UIViewController {
NSTimer *myTimer;
}
@property (nonatomic, retain) NSTimer *myTimer;
Dans mon fichier .m
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDown) userInfo:nil repeats:YES];
}
- (void)countDown {
int counterInt = 100;
int newTime = counterInt - 1;
lblCountdown.text = [NSString stringWithFormat:@"%d", newTime];
}
Et j'infirment 'myTimer' dans mon dealloc. Alors, quelqu'un peut-il me dire ce qui ne va pas avec mon code.
Merci .. J'ai oublié que .. – sicKo