12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // XYApplyAgentSuccessView.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/1/9.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "XYApplyAgentSuccessView.h"
- @interface XYApplyAgentSuccessView ()
- @property (nonatomic, readwrite, strong) UIView *line;
- @property (nonatomic, readwrite, strong) UIButton *applyUnwindButton;
- @end
- @implementation XYApplyAgentSuccessView
- #pragma mark - Public Method
- #pragma mark - Private Method
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- // 初始化
- [self _setup];
-
- // 创建子控件
- [self _setupSubViews];
-
- // 布局子控件
- [self _makeSubViewsConstraints];
- }
- return self;
- }
- #pragma mark - 事件处理Or辅助方法
- - (void)applyUnwindButtonAction:(id)sender {
- if (self.applyUnwindButtonActionBlock) {
- self.applyUnwindButtonActionBlock();
- }
- }
- #pragma mark - Private Method
- - (void)_setup{
- self.backgroundColor = Color_White;
- }
- #pragma mark - 创建子控件
- - (void)_setupSubViews{
- [self addSubview:self.line];
- [self addSubview:self.applyUnwindButton];
-
- [self.applyUnwindButton addTarget:self action:@selector(applyUnwindButtonAction:) forControlEvents:UIControlEventTouchUpInside];
- }
- #pragma mark - 布局子控件
- - (void)_makeSubViewsConstraints{
- [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.top.equalTo(self);
- make.height.equalTo(@2.0f);
- }];
- [self.applyUnwindButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self);
- make.width.equalTo(@160.0f);
- make.height.equalTo(@42.0f);
- }];
-
- [self.applyUnwindButton addViewBorder:Color_Clear redian:21.0f];
- }
- - (UIView *)line {
- if (!_line) {
- _line = [UIView new];
- _line.backgroundColor = Color_Background;
- }
- return _line;
- }
- - (UIButton *)applyUnwindButton {
- if (!_applyUnwindButton) {
- _applyUnwindButton = [UIButton createButtonTextColor:Color_White textFont:Font_B(18)];
- [_applyUnwindButton setTitle:kLocalizedString(@"申请解约") forState:UIControlStateNormal];
- UIImage *image = [UIImage commonRedGradientColorImageWithImgSize:CGSizeMake(160.0f, 42.0f)];
- [_applyUnwindButton setBackgroundImage:image forState:UIControlStateNormal];
- }
- return _applyUnwindButton;
- }
- @end
|