我有一个UITableView叫做症状表...并且在可以补救的时候有可补救UISwitch我UIImage在症状表格UISwitch单元格上显示突出显示该单元格为ON.当我在第一症状的可补救措施中打开时,我正在显示,UISwitch但是细胞正在被重复使用,并且图像也在其他症状视图细胞中显示.任何人都可以帮我解决这个问题吗?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView==symptomsTableView)
{
PPsymptomTableCell *cell;
static NSString *cellIdentifier=@"cellIdentifier";
cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell==nil)
{
cell=[[PPsymptomTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
}
int symptomIDSelected;
symptomIDSelected = [[[mainsymptArray objectAtIndex:indexPath.row]objectForKey:@"SymptID"]intValue];
NSLog(@"%d",[[activeNotificationDictionary objectForKey:[NSNumber numberWithInt:symptomIDSelected]]intValue]);
for (int i = 0; i<activeNotificationDictionary.count; i++)
{
if([[activeNotificationDictionary objectForKey:[NSNumber numberWithInt:symptomIDSelected]]intValue] == symptomIDSelected)
{
cell.selectedCellImageDisplay.hidden=NO;
}
else
{
cell.selectedCellImageDisplay.hidden=YES;
}
}
NSLog(@"end of symptoms cell for row");
if (searching==YES)
{
cell.symptomCellLabel.text=[[searchSymptomsArray objectAtIndex:indexPath.row] objectForKey:@"SymptName"];
cell.backgroundColor=[UIColor clearColor]; …Run Code Online (Sandbox Code Playgroud)