Ios 我正在使用自定义类创建tableview单元格。当我滚动tableview值时会发生什么?

Ios 我正在使用自定义类创建tableview单元格。当我滚动tableview值时会发生什么?,ios,Ios,}试试看 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *leftTableIdentifier = @"Cell"; customTableCell *cell = (customTableCell *)[tableView dequeueReusableCellWithIdentifier:

}试试看

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



static NSString *leftTableIdentifier = @"Cell";

customTableCell *cell = (customTableCell *)[tableView dequeueReusableCellWithIdentifier:leftTableIdentifier];

if (!cell)
{
    //cell = [[customTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:leftTableIdentifier];
    NSArray *ar = [[NSBundle mainBundle]loadNibNamed:@"customTable" owner:nil options:nil];
                    cell= [ar objectAtIndex:0];
}

BOOL isSelected = [selectedArray containsObject:indexPath];
cell.lblInfo.numberOfLines = isSelected?0:2;

NSString *text = [items objectAtIndex:indexPath.row];
cell.lblInfo.text = text;


NSString *buttonTitle = isSelected?@"See Less":@"See More";
[cell.btnTitle setTitle:buttonTitle forState:UIControlStateNormal];
[cell.btnTitle setBackgroundColor:[UIColor redColor]];
[cell.btnTitle addTarget:self action:@selector(clickMe:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnTitle setTag:indexPath.row];

cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


    static NSString *leftTableIdentifier = @"Cell";

    customTableCell *cell = (customTableCell *)[tableView dequeueReusableCellWithIdentifier:leftTableIdentifier];

    if (!cell)
    {
        //cell = [[customTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:leftTableIdentifier];
        NSArray *ar = [[NSBundle mainBundle]loadNibNamed:@"customTable" owner:nil options:nil];
        cell= [ar objectAtIndex:0];

        BOOL isSelected = [selectedArray containsObject:indexPath];
        cell.lblInfo.numberOfLines = isSelected?0:2;

        NSString *text = [items objectAtIndex:indexPath.row];
        cell.lblInfo.text = text;


        NSString *buttonTitle = isSelected?@"See Less":@"See More";
        [cell.btnTitle setTitle:buttonTitle forState:UIControlStateNormal];
        [cell.btnTitle setBackgroundColor:[UIColor redColor]];
        [cell.btnTitle addTarget:self action:@selector(clickMe:) forControlEvents:UIControlEventTouchUpInside];
        [cell.btnTitle setTag:indexPath.row];

        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}