Iphone 当UITableView滚动时,展开的单元格重叠

Iphone 当UITableView滚动时,展开的单元格重叠,iphone,uitableview,Iphone,Uitableview,当uitableview被滚动时,展开的单元格被洗牌,整个表格单元格被洗牌和重叠。为什么会发生这种情况,我如何设置。请引导,提前感谢 代码如下: -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell; if(ta

当uitableview被滚动时,展开的单元格被洗牌,整个表格单元格被洗牌和重叠。为什么会发生这种情况,我如何设置。请引导,提前感谢

代码如下:

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell;

if(tableView == self.mTableView)
{
 cell = [self.mTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
}

if(tableView == self.mMenuTableView)
{
cell = [self.mMenuTableView dequeueReusableCellWithIdentifier:CellIdentifier];

     if (cell == nil)
     {
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
     }
         if(indexPath.section == 0)
         {

             if(!isShowingList)
             {
                 cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"event_exp.png"]];
             }

             else
             {

                 if(indexPath.row == 0)
                 {
                     cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"event_exp_active.png"]];
                 }

                 if(indexPath.row == 1)
                 {
                 cell.textLabel.text = [self.mArrSubMenuEvent objectAtIndex:0];
                     cell.backgroundColor = [UIColor colorWithRed:56.0/255.0 green:218.0/255.0 blue:250.0/255.0 alpha:1.0];
                 }
                 if(indexPath.row == 2)
                 {
                     cell.textLabel.text = [self.mArrSubMenuEvent objectAtIndex:1];

                 }
                 if(indexPath.row == 3)
                 {
                     cell.textLabel.text = [self.mArrSubMenuEvent objectAtIndex:2];
                }

             }

         }

         if(indexPath.section == 1)
         {

             if(!isOverhead)
             {
                 cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"overhead_exp.png"]];
             }
             else
             {
             if(indexPath.row == 0)
             {

             cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"overhead_exp_active.png"]];

             }

             if(indexPath.row == 1)
             {
                 cell.textLabel.text = @"Friend";
             }

             if(indexPath.row == 2)
             {
                 cell.textLabel.text = @"Public";
             }

             }

         }

         if(indexPath.section == 2)
         {

             NSString *imgName = [self.mArrCellImages objectAtIndex:indexPath.row];
             cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imgName]];
         }

     }

cell.selectionStyle = UITableViewCellSelectionStyleNone;

return cell;
}

将reuseIdentifier设置为nil

cell = [self.mTableView dequeueReusableCellWithIdentifier:nil];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    }

将reuseIdentifier设置为nil

cell = [self.mTableView dequeueReusableCellWithIdentifier:nil];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    }

请给我的朋友写一些你的密码CellforRowAtIndex@NitinGohel请检查代码。请我的朋友把你的一些代码CellforRowAtIndex@NitinGohel请检查代码。但请尽量避免使用此解决方案,因为它成本高昂!!但请尽量避免使用此解决方案,因为它成本高昂!!