Custom UITableViewCell not properly hiding views
- by adamweeks
I am using apple's custom table view cell code and modifying the drawRect code within the cell's view to look like I want it to. I've changed it to have some UILabels as well as a UIProgressView.
If the data the cell is being built on doesn't have a certain field, I want the UIProgressView to be hidden. This works for a little while, but when a cell gets requeued, the progress view will start displaying again, even when I set it to hidden = YES. I've tried just not creating the ProgressView unless the data was there and that didn't work either.
I thought the answer was in the [self setNeedsDisplay] but that doesn't seem to help.
Here is the code for the progressview from drawRect that continues to be displayed:
UIProgressView *c1Progress = [[UIProgressView alloc]initWithFrame:CGRectMake(20.0, 70.0, 280.0, 12.0)];
float iProgress = (value / target);
c1Progress.progress = iProgress;
if (!dataExists) {
c1Progress.hidden = YES;
}
[self addSubview:criteria1Progress];
[c1Progress release];