| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // HJBlankView.m
- // HappyJob
- //
- // Created by Bob on 2019/5/21.
- // Copyright © 2019 Bob. All rights reserved.
- //
- #import "HJBlankView.h"
- @interface HJBlankView ()
- @property (nonatomic, strong) UIView *canvasView;
- @end
- @implementation HJBlankView
- - (instancetype)init {
-
- if (self = [super init])
- {
- // self.backgroundColor = [UIColor redColor];
-
- [self addSubview:self.canvasView];
- [self.canvasView addSubview:self.imageView];
- [self.canvasView addSubview:self.titleLabel];
- [self.canvasView addSubview:self.detailLabel];
- [self makeConstraints];
- }
- return self;
- }
- - (void)makeConstraints {
-
- [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.centerX.equalTo(self.canvasView);
- }];
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.centerX.equalTo(self.canvasView);
- make.top.equalTo(self.imageView.mas_bottom).offset(45);
- }];
- [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLabel.mas_bottom).with.offset(10);
- make.centerX.equalTo(self.canvasView);
- }];
- [self.canvasView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.imageView);
- make.left.right.bottom.equalTo(self.detailLabel);
- make.center.equalTo(self);
- }];
- }
- #pragma mark - getters and setters
- - (UIView *)canvasView {
-
- if (_canvasView == nil)
- {
- _canvasView = [[UIView alloc] init];
- // _canvasView.backgroundColor = [UIColor yellowColor];
- }
- return _canvasView;
- }
- - (UIImageView *)imageView {
-
- if (_imageView == nil)
- {
- _imageView = [[UIImageView alloc] init];
- _imageView.image = [UIImage imageNamed:@"blank_pages_icon"];
- }
- return _imageView;
- }
- - (UILabel *)titleLabel {
-
- if (_titleLabel == nil)
- {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.text = @"空空如也";
- _titleLabel.textColor = COLOR_BACK_31;
- _titleLabel.font = [UIFont boldSystemFontOfSize:21];
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- }
- return _titleLabel;
- }
- - (UILabel *)detailLabel {
-
- if (_detailLabel == nil)
- {
- _detailLabel = [[UILabel alloc] init];
- _detailLabel.textColor = COLOR_GRAY_88;
- _detailLabel.text = @"您目前没有正在进行中的订单";
- _detailLabel.font = [UIFont systemFontOfSize:16];
- _detailLabel.textAlignment = NSTextAlignmentCenter;
- _detailLabel.numberOfLines = 0;
- }
- return _detailLabel;
- }
- @end
|