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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//
// InspectPicAddCell.m
// 拍照
//
// Created by admin on 15/12/4.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectPicAddCell.h"
@implementation InspectPicAddCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.contentView.backgroundColor = kFootViewBackGroundColor;
}
- (UIButton *)photoButton1
{
if (!_photoButton1) {
_photoButton1 = [[UIButton alloc] init];
_photoButton1.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_photoButton1];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-(kScreenWidth / 2 + 10)];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-10];
[self.contentView addConstraint:overDateBottom];
}
return _photoButton1;
}
- (UIButton *)photoButton2
{
if (!_photoButton2) {
_photoButton2 = [[UIButton alloc] init];
[_photoButton2 setImage:[UIImage imageNamed:@"add-photo_icon"] forState:UIControlStateNormal];
_photoButton2.translatesAutoresizingMaskIntoConstraints = NO;
_photoButton2.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:_photoButton2];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:kScreenWidth / 2 + 10];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
}
return _photoButton2;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end