TemplateShareButton.m
1.17 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
//
// TemplateShareButton.m
// CNLiveScioLive
//
// Created by CNLive-zxw on 2018/10/20.
// Copyright © 2018年 CNLive. All rights reserved.
//
#import "TemplateShareButton.h"
@implementation TemplateShareButton{
UILabel *_titleLabel;
}
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.imageEdgeInsets = UIEdgeInsetsMake(10.0f,10.0f, 10.0f, 10.0f);
_titleLabel = [[UILabel alloc]init];
_titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:12.f];
_titleLabel.textColor = [ UIColor colorWithRed:255.0 green:255.0 blue:255.0 alpha:1];
_titleLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:_titleLabel];
}
return self;
}
#pragma mark -- Getter and Setter
- (void)setTitle:(NSString *)title{
_title = title;
_titleLabel.text = _title;
}
- (void)setImage:(NSString *)image{
_image = image;
[self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
}
- (void)layoutSubviews{
[super layoutSubviews];
_titleLabel.frame = CGRectMake(0, self.frame.size.width, self.frame.size.width, 12.0f);
}
@end