| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- //
- // CommoditysCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/1/11.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "CommoditysCell.h"
- @implementation CommoditysCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
-
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line];
-
- line.sd_layout
- .leftEqualToView(self.contentView)
- .heightIs(10)
- .rightEqualToView(self.contentView)
- .topEqualToView(self.contentView);
- }
- return self;
- }
- - (void)assignment:(OrderdetailModel*)model {
- for (int i = 0; i<model.commoditys.count; i++) {
- UILabel *commoditys = [UILabel new];
- commoditys.text = [NSString stringWithFormat:@"%@",model.commoditys[i][@"commodityName"]];
- commoditys.font = NewFont(fitScreenWidth(14));
- commoditys.textAlignment = NSTextAlignmentLeft;
- commoditys.frame = CGRectMake(15, 20+(30*i), SCREEN_WIDTH/2-30-20, 15);
- commoditys.backgroundColor = NewClearColor;
- commoditys.lineBreakMode = NSLineBreakByTruncatingTail;
- [self.contentView addSubview:commoditys];
-
- UILabel *shuliang = [UILabel new];
- shuliang.text = [NSString stringWithFormat:@"x%@",model.commoditys[i][@"commodityQuantity"]];
- shuliang.font = NewFont(fitScreenWidth(12));
- shuliang.textAlignment = NSTextAlignmentCenter;
- shuliang.backgroundColor = NewClearColor;
- shuliang.frame = CGRectMake(SCREEN_WIDTH/2-15, 20+(30*i), 30, 15);
- [self.contentView addSubview:shuliang];
-
- UILabel *jiage = [UILabel new];
- jiage.font = NewFont(fitScreenWidth(14));
- jiage.text = [NSString stringWithFormat:@"价格:%@",model.commoditys[i][@"commodityPrice"]];
- jiage.textAlignment = NSTextAlignmentRight;
- jiage.backgroundColor = NewClearColor;
- [jiage setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:jiage];
-
- jiage.sd_layout
- .rightSpaceToView(self.contentView, 15)
- .heightIs(15)
- .yIs(20+(30*i));
-
-
- }
- }
- - (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
|