在我的應用程序中,我在表格視圖中添加了一個滑塊,即每行都包含一個滑塊&它也可以正常工作。Slider在Iphone SDK的表格視圖中重新加載
但是,當我滾動表視圖滑塊得到重新載入,即每個顯示我的起始位置,而不是滑塊值。
//My code is as follow for slider in table cell:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier=[NSString stringWithFormat:@"CellIdentifier%d",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
return cell;
}
UISlider* theSlider = [[[UISlider alloc] initWithFrame:CGRectMake(174,12,120,23)] autorelease];
theSlider.maximumValue=99;
theSlider.minimumValue=0;
[cell addSubview:theSlider];
return cell;
}
我該如何解決這個問題?
感謝您的回覆!但我的表視圖或它不顯示任何與此代碼的行。 – user1673099 2013-02-21 11:32:15
我編輯了代碼。現在試試。 – Raj 2013-02-21 12:29:04
非常感謝! – user1673099 2013-02-21 12:49:35