For whatever reason.. when I move past it (go down), the slider gets weird and it graphica开发者_Python百科lly changes and doesnt retain a value.
Notice you can see a shadow of where it was. Any help is greatly appreciated.
I just found the answer....
All your custom "initWithFrame" code like this:
UISlider *theSlider = [[[UISlider alloc] initWithFrame:CGRectMake(55,20,220,45)] autorelease];
theSlider.maximumValue=10;
theSlider.minimumValue=0;
[cell addSubview:theSlider];
Has to be inside this block, or else every time it will try to redraw:
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
I had it like this:
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UISlider *theSlider = [[[UISlider alloc] initWithFrame:CGRectMake(55,20,220,45)] autorelease];
theSlider.maximumValue=10;
theSlider.minimumValue=0;
[cell addSubview:theSlider];
}
精彩评论