| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- //
- // HJConfirmPanelViewController.m
- // HappyJob
- //
- // Created by Bob on 2019/4/16.
- // Copyright © 2019 Bob. All rights reserved.
- //
- #import "HJConfirmPanelViewController.h"
- @interface HJConfirmPanelViewController ()
- @property (nonatomic, strong) UIView *contentView;
- @property (nonatomic, strong) UIView *lineH;
- @property (nonatomic, strong) UIView *lineV;
- @end
- @implementation HJConfirmPanelViewController
- #pragma mark - life cycle
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.view.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.6];
-
- [self.view addSubview:self.contentView];
- [self.contentView addSubview:self.titleIcon];
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.cancelButton];
- [self.contentView addSubview:self.confirmButton];
- [self.contentView addSubview:self.lineH];
- [self.contentView addSubview:self.lineV];
-
- [self makeConstraints];
- }
- - (void)makeConstraints {
-
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view).with.offset(30);
- make.right.equalTo(self.view).with.offset(-30);
- make.centerY.equalTo(self.view);
- }];
- [self.titleIcon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentView).with.offset(42);
- make.centerX.equalTo(self.contentView);
- }];
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleIcon.mas_bottom).with.offset(22);
- make.centerX.equalTo(self.contentView);
- make.left.equalTo(self.contentView).offset(10);
- make.right.equalTo(self.contentView).offset(-10);
- }];
- [self.lineH mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLabel.mas_bottom).with.offset(40);
- make.left.right.equalTo(self.contentView);
- make.height.mas_equalTo(1);
- }];
- [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.contentView);
- make.top.equalTo(self.lineH);
- make.size.mas_equalTo(CGSizeMake(1, 46));
- }];
- [self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.lineH.mas_bottom);
- make.left.equalTo(self.contentView).with.offset(15);
- make.bottom.equalTo(self.contentView);
- make.right.equalTo(self.lineV).with.offset(-10);
- }];
- [self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.lineH.mas_bottom);
- make.left.equalTo(self.lineV).with.offset(10);
- make.bottom.equalTo(self.contentView);
- make.right.equalTo(self.contentView).with.offset(-15);
- }];
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.lineV);
- }];
- }
- #pragma mark - event response
- - (void)cancelButtonClicked:(UIButton *)sender {
-
- [self dismissViewControllerAnimated:YES completion:^{
-
- }];
- }
- #pragma mark - getters and setters
- - (UIView *)contentView {
-
- if (_contentView == nil)
- {
- _contentView = [[UIView alloc] init];
- _contentView.layer.cornerRadius = 12;
- _contentView.layer.masksToBounds = YES;
- _contentView.backgroundColor = [UIColor whiteColor];
- }
- return _contentView;
- }
- - (UIView *)lineH {
-
- if (_lineH == nil)
- {
- _lineH = [[UIView alloc] init];
- _lineH.backgroundColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1.0];
- }
- return _lineH;
- }
- - (UIView *)lineV {
-
- if (_lineV == nil)
- {
- _lineV = [[UIView alloc] init];
- _lineV.backgroundColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1.0];
- }
- return _lineV;
- }
- - (UIImageView *)titleIcon {
-
- if (_titleIcon == nil)
- {
- _titleIcon = [[UIImageView alloc] init];
- _titleIcon.image = [UIImage imageNamed:@"panel_del"];
- }
- return _titleIcon;
- }
- - (UILabel *)titleLabel {
-
- if (_titleLabel == nil)
- {
- _titleLabel = [[UILabel alloc] init];
- _titleLabel.text = @"是否清除?";
- _titleLabel.numberOfLines = 0;
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- _titleLabel.textColor = COLOR_BACK3;
- _titleLabel.font = [UIFont systemFontOfSize:16];
- }
- return _titleLabel;
- }
- - (UIButton *)cancelButton {
-
- if (_cancelButton == nil)
- {
- _cancelButton = [UIButton buttonWithType:UIButtonTypeSystem];
- _cancelButton.titleLabel.font = [UIFont systemFontOfSize:16];
- [_cancelButton setTitle:@"取消" forState:UIControlStateNormal];
- [_cancelButton setTitleColor:[UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0] forState:UIControlStateNormal];
- [_cancelButton addTarget:self action:@selector(cancelButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _cancelButton;
- }
- - (UIButton *)confirmButton {
-
- if (_confirmButton == nil)
- {
- _confirmButton = [UIButton buttonWithType:UIButtonTypeSystem];
- _confirmButton.titleLabel.font = [UIFont systemFontOfSize:16];
- [_confirmButton setTitle:@"确认删除" forState:UIControlStateNormal];
- [_confirmButton setTitleColor:COLOR_BLUE_4183E1 forState:UIControlStateNormal];
- }
- return _confirmButton;
- }
- @end
|