123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- //
- // OrderCommentCell.m
- // jiaPei
- //
- // Created by apple on 16/6/30.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "OrderCommentCell.h"
- @implementation OrderCommentCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- NSMutableArray *labelArray = [NSMutableArray array];
- for (int i = 0; i < 6; i ++) {
-
- UILabel *label = [UILabel new];
- [self.contentView addSubview:label];
- [labelArray addObject:label];
- }
-
- nameLabel = labelArray[0];
- dateLabel = labelArray[1];
-
- contentLabel = labelArray[5];
- contentLabel.numberOfLines = 0;
-
- tag1Label = labelArray[2];
- [tag1Label borderColor:RQMianColor width:1.0 cornorRadios:5];
- tag2Label = labelArray[3];
- [tag2Label borderColor:RQMianColor width:1.0 cornorRadios:5];
- tag3Label = labelArray[4];
- [tag3Label borderColor:RQMianColor width:1.0 cornorRadios:5];
-
- starImageView = nil;
- }
- return self;
- }
- -(void)setDataDic:(NSDictionary *)dataDic
- {
- _dataDic = dataDic;
-
- [nameLabel setText:dataDic[@"TSO_NAME"] Font:Font18 TextColor:KTitleColor Alignment:NSTextAlignmentLeft];
-
- NSString *dateString = dataDic[@"EVALUATETIME"];
- if (dateString.length > 16) {
- dateString = [dataDic[@"EVALUATETIME"] substringToIndex:16];
- }
- [dateLabel setText:dateString Font:Font16 TextColor:KContentTextColor Alignment:NSTextAlignmentRight];
- }
- -(void)layoutSubviews
- {
- //cell的高度 可变+95
-
- CGFloat x,y,w,h;
- x = 20;
- y = 5;
- w = 80;
- h = 25;
- nameLabel.frame = KSetDIYFrame;
- [nameLabel addViewWithRect:CGRectMake(10, h + 4, kSize.width - 20, 1)];
-
- x += w;
- w = kSize.width - x -20;
- dateLabel.frame = KSetDIYFrame;
-
- x = 20;
- y += h + 10;
- h = 16;
- w = h*4.98;
- if (!starImageView) {
- starImageView = [[CDPStarEvaluation alloc] initWithFrame:CGRectMake(x, y, w, h) onTheView:self.contentView];
- }
- [starImageView setStarWithFloat:[_dataDic[@"EI_OVERALL"] floatValue]/5.0];
-
- y += h + 4;
- w = kSize.width - 40;
- h = [_dataDic[@"EI_TEACHLEVEL"] heightForWid:w Font:Font16];
- contentLabel.frame = KSetDIYFrame;
- [contentLabel setText:_dataDic[@"EI_TEACHLEVEL"] Font:Font16 TextColor:KTitleColor Alignment:NSTextAlignmentLeft];
-
-
- y += h + 10;
- h = 25;
- NSArray *array = [_dataDic[@"EI_SRVMANNER"] componentsSeparatedByString:@","];
- if (array.count > 0) {
- CGSize size = [array[0] sizeForFont:Font17];
- w = size.width + 8;
- tag1Label.frame = KSetDIYFrame;
- [tag1Label setText:array[0] Font:Font17 TextColor:RQMianColor Alignment:NSTextAlignmentCenter];
- }
-
- if (array.count > 1) {
- x += w + 10;
- CGSize size = [array[1] sizeForFont:Font17];
- w = size.width + 8;
- tag2Label.frame = KSetDIYFrame;
- [tag2Label setText:array[1] Font:Font17 TextColor:RQMianColor Alignment:NSTextAlignmentCenter];
- }
-
- if (array.count > 2) {
- x += w + 10;
- CGSize size = [array[2] sizeForFont:Font17];
- w = size.width + 8;
- tag3Label.frame = KSetDIYFrame;
- [tag3Label setText:array[2] Font:Font17 TextColor:RQMianColor Alignment:NSTextAlignmentCenter];
- }
-
- [tag1Label addViewWithRect:CGRectMake(0, y + h + 5, kSize.width, 5)];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- @end
|