Custom UITableViewCell not properly hiding views
Posted
by adamweeks
on Stack Overflow
See other posts from Stack Overflow
or by adamweeks
Published on 2010-04-09T03:41:57Z
Indexed on
2010/04/09
3:43 UTC
Read the original article
Hit count: 457
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];
© Stack Overflow or respective owner