UITableViewCell подкласс

У меня есть этот сегмент кода:

if (cell == nil)
{
    CGRect cellFrame = CGRectMake(0,0,300,250);
    cell = [[UITableViewCell alloc] initWithFrame:cellFrame
            reuseIdentifier:CellTableIndetifier];

    CGRect nameLabelRect = CGRectMake(0, 5, 70, 20);
    UILabel* nameLabel = [[UILabel alloc] initWithFrame:nameLabelRect];
    nameLabel.textAlignment = NSTextAlignmentCenter;
    nameLabel.text = @"Name";
    nameLabel.font = [UIFont boldSystemFontOfSize:12];
    [cell.contentView addSubview: nameLabel];

    CGRect colorLabelRect = CGRectMake(0, 25, 70, 20);
    UILabel* colorLabel = [[UILabel alloc] initWithFrame:colorLabelRect];
    colorLabel.textAlignment = NSTextAlignmentCenter;
    colorLabel.text = @"Color";
    colorLabel.font = [UIFont boldSystemFontOfSize:12];
    [cell.contentView addSubview: colorLabel];

    CGRect priceLabelRect = CGRectMake(0, 45, 70, 20);
    UILabel *priceLabel = [[UILabel alloc] initWithFrame:priceLabelRect];
    priceLabel.text = @"Price";
    priceLabel.textAlignment = NSTextAlignmentCenter;
    colorLabel.font = [UIFont boldSystemFontOfSize:12];
    [cell.contentView addSubview:priceLabel];

    CGRect nameValueRect = CGRectMake(80, 5, 200, 20);
    UILabel* nameValue = [[UILabel alloc] initWithFrame: nameValueRect];
    nameValue.tag = kNameValueTag;
    [cell.contentView addSubview:nameValue];

    CGRect colorValueRect = CGRectMake(80, 25, 200, 20);
    UILabel* colorValue = [[UILabel alloc] initWithFrame:colorValueRect];
    colorValue.tag = kColorValueTag;
    [cell.contentView addSubview:colorValue];

    CGRect priceValueRect = CGRectMake(80, 45, 200, 20);
    UILabel *priceValue = [[UILabel alloc] initWithFrame:priceValueRect];
    priceValue.tag = kPriceValueTag;
    [cell.contentView addSubview:priceValue];
}

и я хотел бы превратить это в подкласс, так что я неЯ должен написать все эти строки, я просто говорю, что cell = CustomCell, и он делает все в подклассе.

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

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