I want to delay between each output result for say, 1 second. The code below is not delaying but is processing correctly. Why is it not delaying between each dealCard
?
- (IBAction)startPause
{
if ([self.deal length]>cardNum) {
timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(dealCard) userInfo:nil repeats:NO];
[timer fire];
}
}
- (void) dealCard{
card.text = [NSString stringWithFormat:@"%i",cardNum+1];
cardTo.text = [self.deal substringWithRange:(NSRange){(cardNum+self.randCut)%[self.cardList count],1}];
cardNum=cardNum + 1;
[self startPause];
}
See Question&Answers more detail:os