SurveyResultCell.m 4.32 KB
Newer Older
n22's avatar
n22 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
//
//  SurveyResultCell.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/8/7.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "SurveyResultCell.h"

#define TopMargin 10
#define TitleHeight 20
#define LeftWidth 100
#define TableHeight 150
#define ContentSize 14
@implementation SurveyResultCell

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

- (void)bulidLayout
{
    self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2);
    
n22's avatar
n22 committed
32
    self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight))];
陈俊俊's avatar
陈俊俊 committed
33 34
    self.dateLabel.textColor = GXF_CELL_COLOR;
    self.dateLabel.font = GXF_FOURTEENTH_SIZE;
n22's avatar
n22 committed
35 36
    
    self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.dateLabel.frame), CGRectGetMaxY(self.dateLabel.frame), CGRectGetWidth(self.dateLabel.frame), 30))];
陈俊俊's avatar
陈俊俊 committed
37 38
    self.userNameLabel.textColor = GXF_CONTENT_COLOR;
    self.userNameLabel.font = GXF_SIXTEENTEH_SIZE;
n22's avatar
n22 committed
39 40
    
    self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
陈俊俊's avatar
陈俊俊 committed
41 42
    self.placeLabel.textColor = GXF_CELL_COLOR;
    self.placeLabel.font = GXF_FOURTEENTH_SIZE;
n22's avatar
n22 committed
43 44
    
    self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.placeLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
陈俊俊's avatar
陈俊俊 committed
45 46
    self.priceLabel.textColor = GXF_CELL_COLOR;
    self.priceLabel.font = GXF_FOURTEENTH_SIZE;
n22's avatar
n22 committed
47 48 49
    
    
    self.capacityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.priceLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
陈俊俊's avatar
陈俊俊 committed
50 51
    self.capacityLabel.textColor = GXF_CELL_COLOR;
    self.capacityLabel.font = GXF_FOURTEENTH_SIZE;
n22's avatar
n22 committed
52 53
    
    self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.capacityLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
陈俊俊's avatar
陈俊俊 committed
54 55
    self.qualityLabel.textColor = GXF_CELL_COLOR;
    self.qualityLabel.font = GXF_FOURTEENTH_SIZE;
n22's avatar
n22 committed
56 57
    
    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(TopMargin,TableHeight-1, ScreenSize.width  - TopMargin * 2, 1))];;
陈俊俊's avatar
陈俊俊 committed
58
    self.lineLabel.backgroundColor = GXF_LINE_COLOR;
n22's avatar
n22 committed
59 60
    
    [self.contentView addSubview:self.imageBtn];
n22's avatar
n22 committed
61
    [self.contentView addSubview:self.dateLabel];
n22's avatar
n22 committed
62 63 64 65 66 67 68 69 70 71
    [self.contentView addSubview:self.userNameLabel];
    [self.contentView addSubview:self.placeLabel];
    [self.contentView addSubview:self.priceLabel];
    [self.contentView addSubview:self.capacityLabel];
    [self.contentView addSubview:self.qualityLabel];
    [self.contentView addSubview:self.lineLabel];
    
}

- (void)setSurveyResult:(SurveyResult *)surveyResult{
陈俊俊's avatar
陈俊俊 committed
72
    [self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal];
n22's avatar
n22 committed
73 74
    self.dateLabel.text = [NSString stringWithFormat:@"%@",surveyResult.feedbackTime];
    self.userNameLabel.text = [NSString stringWithFormat:@"反馈人:%@",surveyResult.userName];
陈俊俊's avatar
陈俊俊 committed
75
    self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",surveyResult.place];
陈俊俊's avatar
陈俊俊 committed
76
     NSMutableAttributedString *attributeStr1 = [IBTCommon setTextViewFontOfString:@"价格:" paragraphStyle:0 fontSize:ContentSize color:GXF_CELL_COLOR];
n22's avatar
n22 committed
77 78 79
    NSString *str = [NSString stringWithFormat:@"%@",surveyResult.price];
    [attributeStr1 appendAttributedString:[IBTCommon setTextViewFontOfString:str paragraphStyle:0 fontSize:ContentSize color:[UIColor redColor]]];
    self.priceLabel.attributedText = attributeStr1;
陈俊俊's avatar
陈俊俊 committed
80 81
    self.capacityLabel.text = [NSString stringWithFormat:@"市场容量:%@",surveyResult.capacity];
    self.qualityLabel.text  = [NSString stringWithFormat:@"质量情况:%@",surveyResult.quality];
n22's avatar
n22 committed
82 83 84 85 86 87 88 89 90
}

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

    // Configure the view for the selected state
}

@end