今天在做项目的过程中,遇到了cell重用,经过查找资料和自己的总结,总结出一条简单实用的:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// static NSString *CellIdentifier = @"Cell";
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%ld%ld", [indexPath section],[indexPath row]];////以indexPath来唯一确定cell
RegisteredTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell=[[RegisteredTableViewCell alloc]initWithReuseIdentifier:CellIdentifier];
}