NoticeTableViewCell.m
1.85 KB
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
//
// NoticeTableViewCell.m
// SCIOLiveCN
//
// Created by huayu on 16/6/22.
// Copyright © 2016年 huayu. All rights reserved.
//
#import "NoticeTableViewCell.h"
@implementation NoticeTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 6, MainScreenWidth - 24, 55)];
_titleLabel.numberOfLines = 2;
_titleLabel.textColor = HEXCOLOR(0x333333);
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.backgroundColor = [UIColor clearColor];
[self addSubview:_titleLabel];
_timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 63, MainScreenWidth - 24, 16)];
_timeLabel.textColor = HEXCOLOR(0x666666);
_timeLabel.font = [UIFont systemFontOfSize:12];
_timeLabel.backgroundColor = [UIColor clearColor];
[self addSubview:_timeLabel];
_tagsLabel = [[UILabel alloc] initWithFrame:CGRectMake(MainScreenWidth - 112, 63, 0, 16)];
_tagsLabel.textColor = HEXCOLOR(0xFFFFFF);
_tagsLabel.font = [UIFont systemFontOfSize:12];
_tagsLabel.textAlignment = NSTextAlignmentCenter;
_tagsLabel.backgroundColor = HEXCOLOR(0x195AC9);
_tagsLabel.layer.masksToBounds = YES;
_tagsLabel.layer.cornerRadius = 4.0;
[self addSubview:_tagsLabel];
}
return self;
}
- (void)reSetTagFrame {
CGRect frame = CGRectZero;
if ([_tagsLabel.text length] > 0) {
[_tagsLabel sizeToFit];
frame = _tagsLabel.frame;
frame.size.width += 10;
frame.size.height+= 6;
frame.origin.x = MainScreenWidth - frame.size.width - 22;
frame.origin.y -= 3;
}
[_tagsLabel setFrame:frame];
}
@end