ShoppingCell.m 3.4 KB
Newer Older
zhu's avatar
zhu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
//
//  ShoppingCell.m
//  Lighting
//
//  Created by mac on 16/5/23.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "ShoppingCell.h"
#define Width 800
#define Height self.frame.size.height
#define Gap     5
@implementation ShoppingCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        [self bulidLayout];
    }
    return self;
}

- (void)bulidLayout
{
//    选中
    self.selectedButton=[[UIButton alloc]initWithFrame:CGRectMake(10, 10, Width/15-20, Height-20)];
    [self.selectedButton setBackgroundImage:[UIImage imageNamed:@"box-副本"] forState:UIControlStateNormal];
//    box-副本
    [self.contentView addSubview:self.selectedButton];
    
//   商品图片
    self.goodsImageView=[[UIImageView alloc]initWithFrame:CGRectMake(Width/15, 0, 2*Width/15, Height)];
    self.goodsImageView.image=[UIImage imageNamed:@"05产品库-详情_03"];
    //05产品库-详情_03
     [self.contentView addSubview:self.goodsImageView];
//     商品信息
    self.goodsInformationLabe=[[UILabel alloc]initWithFrame:CGRectMake(3*Width/15, 0, 3*Width/15, Height)];
    self.goodsInformationLabe.text=@"吊灯jkdsfhkdhfkdsh\n2000133434";
    self.goodsInformationLabe.numberOfLines=0;
     [self.contentView addSubview:self.goodsInformationLabe];
//   吊牌价格
    self.tagsPriceLabe=[[UILabel alloc]initWithFrame:CGRectMake(6*Width/15, 0,2*Width/15, Height)];
    self.tagsPriceLabe.text=@"$5500";
     [self.contentView addSubview:self.tagsPriceLabe];
//    成交价格
    self.clinchTextfield=[[UITextField alloc]initWithFrame:CGRectMake(8*Width/15, 0, 2*Width/15, Height)];
    self.clinchTextfield.text=@"$5500";
     [self.contentView addSubview:self.clinchTextfield];
//    数量减
    self.reduceButton=[[UIButton alloc]initWithFrame:CGRectMake(10*Width/15, 0, Width/15, Height)];
    [self.reduceButton setTitle:@"-" forState:UIControlStateNormal];
    [self.reduceButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.reduceButton.titleLabel.font= [UIFont systemFontOfSize: 18.0];

    [self.contentView addSubview:self.reduceButton];
//    商品数量
    self.goodsNumbersLabe=[[UILabel alloc]initWithFrame:CGRectMake(11*Width/15, 0, Width/15, Height)];
    self.goodsNumbersLabe.text=@"1";
    self.goodsNumbersLabe.textAlignment=NSTextAlignmentCenter;
     [self.contentView addSubview:self.goodsNumbersLabe];
//    数量加
    self.addButton=[[UIButton alloc]initWithFrame:CGRectMake(12*Width/15, 0, Width/15, Height)];
    [self.addButton setTitle:@"+" forState:UIControlStateNormal];
    [self.addButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.addButton.titleLabel.font= [UIFont systemFontOfSize: 18.0];
    [self.contentView addSubview:self.addButton];
//    产品金额
    self.productPriceLabe=[[UILabel alloc]initWithFrame:CGRectMake(13*Width/15, 0, 2*Width/15, Height)];
     self.productPriceLabe.text=@"$5500";
    self.productPriceLabe.textColor=[UIColor redColor];
    [self.contentView addSubview:self.productPriceLabe];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end