UISlider不保存UITableView中的值 [英] UISlider not holding values in UITableView
本文介绍了UISlider不保存UITableView中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论出于什么原因..当我经过它(向下)时,滑块都会变得怪异,并且它会以图形方式更改并且不会保留任何值.
For whatever reason.. when I move past it (go down), the slider gets weird and it graphically 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....
所有自定义的"initWithFrame"代码如下:
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];
}
我是这样的:
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];
}
这篇关于UISlider不保存UITableView中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文