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
//
// CustomBorderLabel.m
// Lighting
//
// Created by 曹云霄 on 2016/11/23.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CustomBorderLabel.h"
@implementation CustomBorderLabel
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.font = [UIFont systemFontOfSize:12];
}
return self;
}
- (void)setCustomText:(NSString *)customText
{
_customText = customText;
UIColor *color;
if ([customText isEqualToString:@"行业动态"]) {
color = RGB(133, 210, 107, 1);
}else if ([customText isEqualToString:@"品牌资讯"]) {
color = RGB(0, 127, 210, 1);
}else if ([customText isEqualToString:@"活动公告"]) {
color = RGB(241, 171, 0, 1);
}
self.layer.masksToBounds = YES;
self.layer.borderWidth = 1.0f;
self.layer.borderColor = color.CGColor;
self.layer.cornerRadius = 2.0f;
self.textColor = color;
self.text = _customText;
}
@end