这是我的代码:
- (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选项卡时,单元格都会重复