in my application i have an UILabel showing a time updated every second. I have also draggable objects in the screen. When I hide the label or i stop the timer everything is perfect but when i start the timer the animation performance of dragging objects go down. I put the UILabel updating in a separate thread but no luck. I need help friends :)
This is my code:
self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
-(void) onTimer:(NSTimer *)timer; {
timeInterval ++;
int hours = (int)timeInterval / 3600;
int minutes = (timeInterval %3600)/ 60;
int seconds = ((timeInterval%3600)%60);
NSString *timeDiff = [NSString stringWithFormat:@"%d:%02d:%02d", hours,minutes,seconds];
[NSThread detachNewThreadSelector:@selector(setText:) toTarget:self.time withObject:timeDiff];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.