UITableViewCell повторно использовать хорошую практику

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


    static NSString *CellIdentifier = @"NotificationViewCell";
    CardViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){

        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CardViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];


        cell.contentView.backgroundColor=[UIColor clearColor];
        [ModelClass addSublayer:cell.contentView];


        cell.cellbg.layer.cornerRadius = 8;
        cell.cellbg.layer.masksToBounds = YES;

         cell.cellbg.layer.borderWidth = 1;
         cell.cellbg.layer.borderColor = [[UIColor grayColor] CGColor];


        cell.logoImage.layer.cornerRadius = 8;
        cell.logoImage.layer.masksToBounds = YES;

        cell.logoImage.layer.borderWidth = 1;
        cell.logoImage.layer.borderColor = [[UIColor grayColor] CGColor];



        Merchant *merchantList= [self.cardListArr objectAtIndex:indexPath.row];

        cell.nameLab.text=merchantList.name;

        NSLog(@"merchantList.myloyalty.points=%@",merchantList.myloyalty.points);
    //    NSLog(@"memberNO=%@",merchantList.myloyalty.memberNO);
        cell.integralLab.text=[NSString stringWithFormat:NSLocalizedString(@"points_dot", @"") ,[merchantList.myloyalty.points intValue]];


        cell.cardNumberLab.text=[NSString stringWithFormat:@"%@%@",NSLocalizedString(@"ID", nil), merchantList.myloyalty.memberNO];



        if(![ModelClass isBlankString:merchantList.introPic])
        {
              NSLog(@"merchantList.introPic=%@",merchantList.introPic);

            [cell.logoImage setImageUrl:merchantList.introPic];


        }
    }

    return cell;

}
Я хочу использовать приведенный выше код для повторного использования UITableViewCell, я не знаю, если это правильно, я хочу получить совет.

Вы можете увидеть мой код, который я использую if (cell == nil), я хочу знать, что я должен написать, какой код if (cell! = nil) (if (cell == nil) else {я должен сделать то, что может улучшить повторное использование ячейки })

если каждая ячейка имеет одинаковые виды ,, но имеет разную высоту, например, viewview иногда равен 20 или 40 и т. д., как справиться с ситуацией.

Ответы на вопрос(3)

Ваш ответ на вопрос