//写个定时器
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(LocateUpdate) userInfo:nil repeats:YES];
//刷新时间
- (void)timeUpdate{
NSDate * date = [NSDate date];
NSCalendar * calendar = [NSCalendar currentCalendar];
NSDateComponents * current = [[NSDateComponents alloc]init];
NSInteger string = NSCalendarUnitHour|NSCalendarUnitMinute|NSCalendarUnitSecond;
current = [calendar components:string fromDate:date];
UILabel * label11 = (UILabel * )[self.view viewWithTag:21];
label11.text = [NSString stringWithFormat:@"%lu",[current hour]];
UILabel * label22 = (UILabel * )[self.view viewWithTag:22];
if ([current minute]<10) {
label22.text = [NSString stringWithFormat:@"0%lu",[current minute]];
}else{
label22.text = [NSString stringWithFormat:@"%lu",[current minute]];
}
UILabel * label33 = (UILabel * )[self.view viewWithTag:23];
if ([current second]<10) {
label33.text = [NSString stringWithFormat:@"0%lu",[current second]];
}else{
label33.text = [NSString stringWithFormat:@"%lu",[current second]];
}
}