InspectAddCell.m 3.97 KB
Newer Older
admin's avatar
admin committed
1
//
2
//  InspectAddCell.m
admin's avatar
admin committed
3 4
//  redstar
//
5
//  Created by admin on 15/12/3.
admin's avatar
admin committed
6 7 8
//  Copyright © 2015年 ZWF. All rights reserved.
//

9
#import "InspectAddCell.h"
admin's avatar
admin committed
10

11
@implementation InspectAddCell
admin's avatar
admin committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25

#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
{
26
    self.contentView.backgroundColor = kFootViewBackGroundColor;
27

admin's avatar
admin committed
28 29 30 31 32 33
}

- (UIButton *)photoButton
{
    if (!_photoButton) {
        _photoButton = [[UIButton alloc] init];
34
        _photoButton.backgroundColor = [UIColor whiteColor];
admin's avatar
admin committed
35
        _photoButton.translatesAutoresizingMaskIntoConstraints = NO;
admin's avatar
admin committed
36
        [_photoButton setImage:[UIImage imageNamed:@"add-photo_icon"] forState:UIControlStateNormal];
admin's avatar
admin committed
37 38 39 40 41 42 43 44 45 46 47 48 49
        [self.contentView addSubview:_photoButton];
        
        NSLayoutConstraint *overDateTop = [NSLayoutConstraint
                                           constraintWithItem:_photoButton
                                           attribute:NSLayoutAttributeTop
                                           relatedBy:NSLayoutRelationEqual
                                           toItem:self.contentView
                                           attribute:NSLayoutAttributeTop
                                           multiplier:1.0
                                           constant:5];
        [self.contentView addConstraint:overDateTop];
        
        self.overDateLeft = [NSLayoutConstraint
50 51 52 53 54 55 56
                             constraintWithItem:_photoButton
                             attribute:NSLayoutAttributeLeft
                             relatedBy:NSLayoutRelationEqual
                             toItem:self.contentView
                             attribute:NSLayoutAttributeLeft
                             multiplier:1.0
                             constant:20];
admin's avatar
admin committed
57 58 59
        [self.contentView addConstraint:_overDateLeft];
        
        self.overDateRight = [NSLayoutConstraint
60 61 62 63 64 65 66
                              constraintWithItem:_photoButton
                              attribute:NSLayoutAttributeRight
                              relatedBy:NSLayoutRelationEqual
                              toItem:self.contentView
                              attribute:NSLayoutAttributeRight
                              multiplier:1.0
                              constant:-(kScreenWidth / 2 + 10)];
admin's avatar
admin committed
67 68 69
        [self.contentView addConstraint:_overDateRight];
        
        NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
70 71 72 73 74 75 76
                                              constraintWithItem:_photoButton
                                              attribute:NSLayoutAttributeHeight
                                              relatedBy:NSLayoutRelationEqual
                                              toItem:nil
                                              attribute:NSLayoutAttributeNotAnAttribute
                                              multiplier:1.0
                                              constant:90];
admin's avatar
admin committed
77 78 79 80 81 82 83 84 85
        [self.contentView addConstraint:overDateHeight];
        
        NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
                                              constraintWithItem:_photoButton
                                              attribute:NSLayoutAttributeBottom
                                              relatedBy:NSLayoutRelationEqual
                                              toItem:self.contentView
                                              attribute:NSLayoutAttributeBottom
                                              multiplier:1.0
86
                                              constant:-10];
admin's avatar
admin committed
87 88 89 90 91
        [self.contentView addConstraint:overDateBottom];
    }
    return _photoButton;
}

92 93 94



admin's avatar
admin committed
95 96 97 98 99 100 101
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end