0

这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  { 
     static NSString *CellIdentifier = @"simpleTable";
     profileCellViewController *cell = [self.myTable dequeueReusableCellWithIdentifier:CellIdentifier];   
        if (cell == nil)
        {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"simpleTable" owner:self options:nil];
            cell = [nib objectAtIndex:0]; 
        }
  //loading data
   ...
   ...
   ...

     cell.name.text     = name;
     cell.time.text = time;
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
     return cell;
  }

我知道问题出在 if (cell==nil) 部分,但真的不知道我能解决这个问题......每次我回到这个 viewcontroller 选项卡时,单元格都会重复

4

0 回答 0