// // 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