Hi everyone,
Please help!
I define a custom UIControl with three labels, then on the viewDidLoad function of the main view controller, I repeatedly add multiple instances of that UIControl into the scroll view.
I need one of the label within the UIControl to be updated with new value each second. I have a question, how to clear the previously drawn custom view? Or what is the method for updating that label with best drawing performance?
- (void) updateMinuteLabel{
CustomIconControl *control = nil;
for (control in scrollView.subviews){
if ([view isKindOfClass:[CustomIconControl class]] && control.tag >0){
CustomIconControl *item = (CustomIconControl *) control;
item.intMinute += 1;
[item setNeedsDisplay];
}
}
}
In the drawRect: funtion of the CustomIconControl, I use the
[minuteString drawInRect: minuteRect withFont: [UIFont systemFontOfSize:10];
With this code, it continues to draw without clearing out the previously drawn controls.
Can someone help ? Please tell me if you need more information, offcourse I have the code for custom drawing part of the CustomIconControl, the initialization of the timer, viewDidLoad etc...