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
87
88
89
90
91
92
93
94
//
// NotuceRecordCell.m
// XFFruit
//
// Created by mac on 15/9/16.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "NotuceRecordCell.h"
#define LeftMargin 10
@implementation NotuceRecordCell
- (void)awakeFromNib {
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
self.contentView.backgroundColor = XXFBgColor;
UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 5, ScreenSize.width, 130 -10)];
bgView.backgroundColor = [UIColor whiteColor];
// bgView.layer.cornerRadius = 5;
// bgView.layer.masksToBounds = YES;
[self.contentView addSubview:bgView];
self.createdLable = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 0, bgView.width - 100, 30)];//业务时间
self.createdLable.font = GXF_FIFTEENTEN_SIZE;
self.createdLable.textColor = GXF_NAVIGAYION_COLOR;
self.createdLable.text = @"2015-04-05 09:05:05";
self.creatorLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.right, 0, bgView.width - self.createdLable.width - LeftMargin * 2, 30)];//业务人
self.creatorLable.font = GXF_FIFTEENTEN_SIZE;
self.creatorLable.textAlignment = NSTextAlignmentRight;
self.creatorLable.textColor = GXF_NAVIGAYION_COLOR;
self.traceIdLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.createdLable.bottom, bgView.width - LeftMargin*2, 20)];//采购通知单uuid
self.traceIdLable.font = GXF_FIFTEENTEN_SIZE;
self.traceIdLable.textColor = GXF_CELL_COLOR;
self.typeLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.traceIdLable.bottom, bgView.width- LeftMargin*2, 20)];//业务类型
self.typeLable.font = GXF_FIFTEENTEN_SIZE;
self.typeLable.textColor = GXF_CELL_COLOR;
self.remarkLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.typeLable.bottom, bgView.width-LeftMargin*2, 20)];//日志描述信息
self.remarkLable.font = GXF_FIFTEENTEN_SIZE;
self.remarkLable.textColor = GXF_CELL_COLOR;
[bgView addSubview:self.createdLable];
[bgView addSubview:self.creatorLable];
[bgView addSubview:self.traceIdLable];
[bgView addSubview:self.remarkLable];
[bgView addSubview:self.typeLable];
[bgView addSubview:self.uuidLable];
}
- (void)setNoticeRecode:(NoticeRecord *)noticeRecode withNumber:(NSString *)number{
self.creatorLable.text = [NSString stringWithFormat:@"%@",noticeRecode.creator];
self.createdLable.text = [NSString stringWithFormat:@"%@",noticeRecode.created];
self.traceIdLable.text = [NSString stringWithFormat:@"单号:%@",number];
NSMutableAttributedString *attributeStr1 = [IBTCommon setTextViewFontOfString:@"类型:" paragraphStyle:0 fontSize:15 color:GXF_CELL_COLOR];
NSString *str = @"";
if ([noticeRecode.type isEqualToString:@"noticeAccepted"]) {
str = @"接受任务";
}else if ([noticeRecode.type isEqualToString:@"billCreated"]){
str = @"新建采购单";
}
[attributeStr1 appendAttributedString:[IBTCommon setTextViewFontOfString:str paragraphStyle:0 fontSize:15 color:[UIColor redColor]]];
self.typeLable.attributedText = attributeStr1;
self.remarkLable.text = [NSString stringWithFormat:@"备注:%@",noticeRecode.remark];
self.remarkLable.numberOfLines = 0;
CGFloat height = [self.remarkLable calculateHeight];
if (height > 20) {
self.remarkLable.height = height;
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end