Я новичок в программировании на iOS. Я работаю над словами, соответствующими игре. В этой игре мне нужно установить счетчик времени, который показывает минуты и секунды. Я хочу, когда моя игра начнется с моего таймера, чтобы начать с 3 минут. Теперь я хочу уменьшить этот таймер в обратном направлении с помощью секунд. мой код работает в течение нескольких секунд... мой код:
secondsLeft--;
int seconds = (secondsLeft %3600) % 60;
Timerlbl.text = [NSString stringWithFormat:@"%02d",seconds];
if (seconds==0)
{
UIAlertView *pAlert = [[UIAlertView alloc]initWithTitle:@"Sorry!!"
message:@"TimeOver" delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:@"Cancel",nil];
[pAlert show];
[pAlert release];
}
}
В Viewdidload я вызываю его через таймер..
countDown=[NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(TimeOver) userInfo:nil repeats:YES];
просьба помочь мне, как я могу сделать это за обе минуты и секунды.