【发布时间】:2011-07-21 14:06:12
【问题描述】:
基本上,我有一个 uitableview,每个单元格都包含一个 uiprogressview 和一个 uiswitch。切换开关会切换进度视图的可见性。
但是。
如果我在第 0 行切换开关。 row:0 AND row:11 中的进度视图显示。
我的开关有这个: [(UISwitch *)cell.accessoryView addTarget:self action:@selector(PrefetchStudy:) forControlEvents:UIControlEventValueChanged];
下面是动作:
-(void)PrefetchStudy:(id)sender
{
UISwitch *tmpSwitch = (UISwitch*)sender;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:tmpSwitch.tag inSection:0];
CustomCell *cell = (CustomCell *)[self.tableview cellForRowAtIndexPath:indexPath];
NSString *tmp = cell.patient_name.text;
NSLog(@"This is the patient name of the selected row: %@", tmp);
if(tmpSwitch.on)
{
cell.progressBar.hidden = NO;
}
else
{
cell.progressBar.hidden = YES;
}
}
关于为什么会发生这种情况的任何建议?
【问题讨论】:
标签: objective-c uitableview uiswitch uiprogressview