Timer code: _hour,_minute initial value is 0;
Calculation time
-(void) time
{
Execute @selector after 60 seconds: method
_timer = [nstimer scheduledtimerwithtimeinterval:60.0f target: Self Selector:@selector(updatetimer:) userInfo:nil repeats:YES];
< Span class= "S6" > < Span class= "S3" >//is displayed when the minute is 0: time 0:0
_iwifiview. Onlinetime. Text = [nsstring stringwithformat:@ "%d time%d ", _hour, _ Minute];
}
-(void) Updatetimer: (nstimer *) sender{
Output test
NSLog(@ " time %d %d ", _hour, _minute );
When 1 hours are reached, change the display time of the hour and let the minutes start again from zero
if (_minute = = ) {
_hour++;
_minute = 0;
}else{
_minute++;
}
Time is a label, and it is displayed with a label
_time. Text = [nsstring stringwithformat:@ "%d time%d ", _hour , _minute];
}
Ordinary timer implementation