123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // XYSkillCertificationApplyBoxView.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/10/26.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "XYSkillCertificationApplyBoxView.h"
- @interface XYSkillCertificationApplyBoxView ()
- @property (nonatomic, strong) UIImageView *moreImageView;
- @property (nonatomic, strong) UIButton *actionButton;
- @property (nonatomic, strong) UIView *line;
- @end
- @implementation XYSkillCertificationApplyBoxView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- [self setupUI];
- }
- return self;
- }
- #pragma mark — UI
- - (void)setupUI {
- [self addSubview:self.titleLabel];
- [self addSubview:self.contentLabel];
- [self addSubview:self.moreImageView];
- [self addSubview:self.actionButton];
- [self addSubview:self.line];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self).offset(20.0f);
- make.centerY.equalTo(self);
- }];
- [self.moreImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self).offset(-20.0f);
- make.centerY.equalTo(self);
- make.width.height.equalTo(@18.0f);
- }];
- [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.moreImageView.mas_left);
- make.centerY.equalTo(self);
- make.left.greaterThanOrEqualTo(self.titleLabel.mas_right).offset(10.0f);
- }];
- [self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
- [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.equalTo(self);
- make.height.equalTo(@0.55f);
- }];
- }
- - (void)actionButton:(id)sender {
- if (self.actionBlock) {
- self.actionBlock();
- }
- }
- #pragma mark — Getter
- - (UILabel *)titleLabel {
- if (!_titleLabel) {
- _titleLabel = [UILabel createLabelTextColor:Color_TextFont fount:Font(14)];
- }
- return _titleLabel;
- }
- - (UILabel *)contentLabel {
- if (!_contentLabel) {
- _contentLabel = [UILabel createLabelTextColor:Color_TextGray fount:Font_B(14)];
- _contentLabel.textAlignment = NSTextAlignmentRight;
- }
- return _contentLabel;
- }
- - (UIImageView *)moreImageView {
- if (!_moreImageView) {
- _moreImageView = [UIImageView new];
- _moreImageView.image = ImageNamed(@"apply_more");
- }
- return _moreImageView;
- }
- - (UIButton *)actionButton {
- if (!_actionButton) {
- _actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
- _actionButton.backgroundColor = Color_Clear;
- [_actionButton addTarget:self action:@selector(actionButton:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _actionButton;
- }
- - (UIView *)line {
- if (!_line) {
- _line = [UIView new];
- _line.backgroundColor = Color_line;
- }
- return _line;
- }
- @end
|