UISlider не содержит значений в UITableView - PullRequest
0 голосов
/ 25 января 2011

what I start off with

По какой-то причине ... когда я двигаюсь мимо него (опускаюсь), ползунок становится странным, он графически изменяется и не сохраняет значения.

What I end up with

Обратите внимание, вы можете увидеть тень от того, где она была.Любая помощь с благодарностью.

1 Ответ

1 голос
/ 25 января 2011

Я только что нашел ответ ....

Весь ваш пользовательский код "initWithFrame", подобный этому:

UISlider *theSlider =  [[[UISlider alloc] initWithFrame:CGRectMake(55,20,220,45)] autorelease];
theSlider.maximumValue=10;
theSlider.minimumValue=0;       
    [cell addSubview:theSlider];

Должен быть внутри этого блока, иначе каждый раз, когда он будет пытаться перерисовать:

 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];
 }
...