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
//
// FooterCell.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "FooterCell.h"
#define HeadWidth 70
#define LeftMargin 13
@interface FooterCell ()
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)NSString *twoTitle;
@property (nonatomic,strong)UILabel *lineLabel;
@end
@implementation FooterCell
- (instancetype)initWithFrame:(CGRect)frame withTitle:(NSString *)title isTwo:(NSString *)twoTitle{
self = [super initWithFrame:frame];
if (self) {
self.title = title;
if (twoTitle.length > 0) {
self.twoTitle = twoTitle;
}
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
addBtn.frame = CGRectMake(0, 0, self.frame.size.width, 50);
[addBtn setTitle:self.title forState:UIControlStateNormal];
addBtn.backgroundColor = [UIColor whiteColor];
[addBtn setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
[addBtn addTarget:self action:@selector(addBtn) forControlEvents:UIControlEventTouchUpInside];
addBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:addBtn];
if (self.twoTitle.length > 0) {
addBtn.frame = CGRectMake(0, 0, self.frame.size.width/2, 50);
UIButton *otherBtn = [UIButton buttonWithType:UIButtonTypeCustom];
otherBtn.frame = CGRectMake(self.frame.size.width/2, 0, self.frame.size.width/2, 50);
[otherBtn setTitle:self.twoTitle forState:UIControlStateNormal];
otherBtn.backgroundColor = [UIColor whiteColor];
[otherBtn setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
[otherBtn addTarget:self action:@selector(otherClick) forControlEvents:UIControlEventTouchUpInside];
otherBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:otherBtn];
}
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.frame.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:self.lineLabel];
}
- (void)addBtn{
if ([self.delegate respondsToSelector:@selector(addClick)]) {
[self.delegate addClick];
}
}
- (void)otherClick{
if ([self.delegate respondsToSelector:@selector(choosePurchase)]) {
[self.delegate choosePurchase];
}
}
@end