IOS 设置定时器  自动滚动视图 定时发送坐标信息 即时显示 时钟

NSTimer *timer;
- (void)start
{//1second 调用一次
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateClock:) userInfo:nil repeats:YES];
}
-(NSString *)updateClock:(NSTimer *)theTimer //精确到分系统时间
{
NSDate * senddate=[NSDate date]; NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init]; // [dateformatter setDateFormat:@"ss:SS"];//hh:mm:ss:SSS
[dateformatter setDateFormat:@"hh:mm"];
NSString * locationString=[dateformatter stringFromDate:senddate];
// NSLog(@"==%@==",locationString);
label_System_hour.text=locationString;
return locationString;
} - (void)stop
{
[timer invalidate];
timer = nil;
}
04-13 17:56