小编roc*_*cky的帖子

UITableViewCell被重用

我有一个UITableView叫做症状表...并且在可以补救的时候有可补救UISwitchUIImage在症状表格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)

iphone objective-c uitableview ios

-2
推荐指数
1
解决办法
163
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

uitableview ×1